Modern JavaScript
About Lesson

In this JavaScript lesson we are going to learn about JavaScript For of Loop, so for .. of is an enhanced version of for .. in  and forEach loops, and it is a feature in JavaScript ES6.

 

 

Now let’s create an example, if you see in this example we have an array of names, now we want to iterate over this array, for iterating we need to use for loop, and you will see the result in the output.

 

 

But in ES6 JavaScript we have a shorter version of for loop that is called for of loop.

 

 

 

Also you can get the index of an array by using entries() function of for of loop.

Thank you for visiting my website! If you enjoyed the free courses, please consider supporting my works on Patreon.
Exercise Files
No Attachment Found
No Attachment Found