Created
November 23, 2018 12:57
-
-
Save frentsel/8bc59952045abce903ca9e3252a50e2e to your computer and use it in GitHub Desktop.
Create a new array with keys in range from 0 to limit
This file contains 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
const newArray = (size) => [...Array(size).keys()]; | |
newArray(5); // [0, 1, 2, 3, 4] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment