Skip to content

Instantly share code, notes, and snippets.

@bbaaxx
Last active November 15, 2017 18:48
Show Gist options
  • Select an option

  • Save bbaaxx/93396dcd12e87fd17b4684e0e07941cc to your computer and use it in GitHub Desktop.

Select an option

Save bbaaxx/93396dcd12e87fd17b4684e0e07941cc to your computer and use it in GitHub Desktop.
Code for blog post about iterators iterables and generators with ES6
const someArray = [2, 4, 8];
let someArraySquared = [];
for (let i = 0; i < someArray.length; i += 1) {
someArraySquared.push(someArray[i] * someArray[i]);
}
console.log(someArray, someArraySquared); // [2, 4, 8], [4, 16, 64]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment