Using for…of to Iterate Over Iterables in Javascript


Iterate over iterable objects (including arrays, strings) using for…of.

Source Code

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