Javascript
JavaScript Fundamentals -- Looping in JavaScript

for ... of Loops

Mute
Current Time 0:00
/
Duration Time 0:00
Loaded: 0%
Progress: 0%
Stream TypeLIVE
Remaining Time -0:00
 
PRO

The for ... of loop is similar to the for loop, but it will loop over each item in the array. You don’t have to tell it how far to go, though, as it will do so automatically. You’ll again create a local variable, though this time you can use const (and I usually do except on the rare occasion I need to reassign the value of the local variable).

This is my preferred method of looping over the values of an array. I like how concise and explicit it is.

For more information on for of loops, read this blog post.

 

I finished! On to the next chapter