![]() |
VOOZH | about |
The JavaScript for...of loop is a modern, iteration statement introduced in ECMAScript 2015 (ES6).
For iterables , the below loops are preferred.
- For of Loop if we need to put continue or break in the loop
- forEach() if we need execute something for all elements without any condition
For Objects, for in loop is better suited.
While the for...of loop is not directly used to iterate over object properties, you can use it in combination with Object.keys(), Object.values(), or Object.entries() to achieve this.
Recommended Links: