Understanding Array.forEach() for Iterating Arrays in Javascript


Execute a function on each item in an array.

Source Code

["apple", "banana", "cherry"].forEach(function(fruit, index) {
  console.log(index, fruit);
});
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments