Top "For-of-loop" questions

Use for-of-loop for questions related to the for.

Access to ES6 array element index inside for-of loop

We can access array elements using a for-of loop: for (const j of [1, 2, 3, 4, 5]) { console.log(j); } How can I modify …

javascript ecmascript-6 for-of-loop
How can a Javascript object become iterable with for...of statement?

I would like to set the options[Symbol.iterator] property in order to iterate on the simple objects I create …

javascript debugging ecmascript-6 iterator for-of-loop
How to iterate over a Set or Map in reverse order in javascript?

I'm looking for a a way to iterate over a Set or Map in reverse order. Consider this simple example …

javascript iterator for-of-loop
for..in or for..of Object keys

So my IDE doesn't like when I use a for..in loop to iterate over an object keys. I get …

javascript object for-loop for-in-loop for-of-loop
for...of loop. Should I use const or let?

When using a for of loop, both of these are allowed and work: const numbers = [1,2,3]; // works for(let number of …

javascript ecmascript-6 for-of-loop
How can I turn off ESLint's no-restricted-syntax rule just for ForOfStatement?

I am using ESLint for my ES6 program, with the AirBNB rule-set. For good and adequate reasons, I am using …

ecmascript-6 eslint for-of-loop
The meaning of "'x' is not a function or its return value is not iterable" error

I accidentally witnessed that this causes an error in V8 (Chrome, Node.js, etc): for (let val of Symbol()) { /*...*/ } TypeError: …

javascript node.js google-chrome v8 for-of-loop