Answers for "foreach loop use in javscript"

9

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

.forEach in Javascript

Array.prototype.forEach.call(node.childNodes, (child) => {
    // Do something with `child`
});
Posted by: Guest on February-22-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language