Answers for "foreach loop create array"

131

javascript array foreach example

const avengers = ['thor', 'captain america', 'hulk'];
avengers.forEach((item, index)=>{
	console.log(index, item)
})
Posted by: Guest on April-27-2020
0

store value in array from foreach loop

$items = array();
foreach($group_membership as $username) {
 $items[] = $username;
}

print_r($items);
Posted by: Guest on May-04-2021

Code answers related to "foreach loop create array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language