Answers for "foreach in javascrip"

131

javascript foreach

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

foreach javascript

let words = ['one', 'two', 'three', 'four'];
words.forEach((word) => {
  console.log(word);
});
// one
// two
// three
// four
Posted by: Guest on May-27-2020
6

foreach loop javascript

const numList = [1, 2, 3];

numList.forEach((number) => {
  console.log(number);
});
Posted by: Guest on October-05-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language