Skip to content

Instantly share code, notes, and snippets.

@LindsayDenotes
Last active February 23, 2016 04:13
Show Gist options
  • Save LindsayDenotes/fdb4f735c45642bf3607 to your computer and use it in GitHub Desktop.
Save LindsayDenotes/fdb4f735c45642bf3607 to your computer and use it in GitHub Desktop.
For Of Loops-NodeDC

#29 For...Of Loops

is similar to a regular JavaScript for loop but extends functionality to es2015 data structures, such as a typed array, map, set, arguments object, and generator. works on familiar data structures such as array, string, and DOM collection. iterates over the items in an iterable object. is the es2015 equivalent of jQuery's .each loop. works differently than a JavaScript for...in loop. Read more about those differences on:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of

side note: let (another es2015 feature) is used in place of var in the example below.

let ourNames = ["lindsay", "jose", "clare"];

for (let name of ourNames) {
  console.log(name);
}
//lindsay
//jose
//clare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment