Saturday, 6 October 2018

JavaScript: for-of loop

for-of loop is used to iterate over iterable objects like String, Array, TypedArray, Map and Set.

HelloWorld.js
var arr = [2, 3, 5, 7, 11, 13];

for (var i of arr) {
   console.log(i);
}

Output
2
3
5
7
11
13



Previous                                                 Next                                                 Home

No comments:

Post a Comment