Skip to content

Instantly share code, notes, and snippets.

@chriswrightdesign
Last active June 23, 2017 03:43
Show Gist options
  • Save chriswrightdesign/e33a866052dc76860bd5881b9c7bc00f to your computer and use it in GitHub Desktop.
Save chriswrightdesign/e33a866052dc76860bd5881b9c7bc00f to your computer and use it in GitHub Desktop.
Array.from mapping function example
Array.from({length: 3});
// result: [undefined, undefined, undefined]
// Array.from's second argument is a mapping function.
Array.from({length: 3}, (currentValue, index) => index);
// result: [0, 1, 2];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment