FrontendDeveloper.in

JavaScript question detail

What is for...of statement

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,

let arrayIterable = [10, 20, 30, 40, 50];

for (let value of arrayIterable) {
value++;
console.log(value); // 11 21 31 41 51
}
Back to all JavaScript questions
Get LinkedIn Premium at Rs 399