Last active
June 23, 2017 03:43
-
-
Save chriswrightdesign/e33a866052dc76860bd5881b9c7bc00f to your computer and use it in GitHub Desktop.
Array.from mapping function example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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