how to store foreach value in array in javascript code example
Example 1: javascript foreach example
var colors = ["red", "blue", "green"];
colors.forEach(function(color) {
console.log(color);
});
Example 2: store value in array from foreach loop
$items = array();
foreach($group_membership as $username) {
$items[] = $username;
}
print_r($items);