Answers for "how to run foreach loop in javascript Set value"

4

loop over javascript using foreach

const obj = {
  name: 'Jean-Luc Picard',
  rank: 'Captain'
};

// Prints "name Jean-Luc Picard" followed by "rank Captain"
Object.keys(obj).forEach(key => {
  console.log(key, obj[key]);
});
Posted by: Guest on October-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 "how to run foreach loop in javascript Set value"

Code answers related to "Javascript"

Browse Popular Code Answers by Language