Answers for "foreach javascript usage"

131

javascript foreach

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

what foreach method returns in javascript

function double(arr) {
  return arr.forEach(num => num*2);
}

console.log(double([1,2,3,4])) //undefined
Posted by: Guest on December-29-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language