1. Home
  2. Javascript
  3. For of loop
#javascript#loop

Similar to for loop but you don't need to specify the number of iterations. The loop uses an iterator function built in to arrays.

var arr = [blue, green, yellow]

for (var color of arr) {
    console.log("The color is " + color);
}
copy
Full Javascript cheatsheet
Sitemap Git repository