Skip to content

Instantly share code, notes, and snippets.

@aderaaij
Last active November 14, 2017 21:48
Show Gist options
  • Save aderaaij/1e9e1e013ea4b13bb98c0a0eccdc9a1e to your computer and use it in GitHub Desktop.
Save aderaaij/1e9e1e013ea4b13bb98c0a0eccdc9a1e to your computer and use it in GitHub Desktop.
The for...of statement creates a loop iterating over iterable objects (including Array, Map, Set, String, TypedArray, arguments object and so on), invoking a custom iteration hook with statements to be executed for the value of each distinct property.
const heroes = ['The Hulk', 'Black Widow', 'Vision', 'Thor'];
for (const hero of heroes) {
if(hero === 'Black Widow') {
break;
}
console.log(hero);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment