JS Coding Questions Logo
JS Coding Questions
#324💼 Interview💻 Code

What is for...of statement

Advertisement

728x90

The for...of statement creates a loop iterating over iterable objects or elements such as built-in String, Array, Array-like objects (like arguments or NodeList), TypedArray, Map, Set, and user-defined iterables. The basic usage of for...of statement on arrays would be as below,

javascript
1let arrayIterable = [10, 20, 30, 40, 50];
2
3for (let value of arrayIterable) {
4  value++;
5  console.log(value); // 11 21 31 41 51
6}

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 67

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
324of476