Iterating Over Arrays with for Loops in Javascript


Use a for loop to iterate over each element in an array.

Source Code

let fruits = ['apple', 'banana', 'cherry'];
for (let i = 0; i < fruits.length; i++) {
  console.log(fruits[i]);
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments