Skip to content

Instantly share code, notes, and snippets.

@chranderson
Created August 8, 2018 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chranderson/d352cc97cca3eceeb3a437c4f45d7770 to your computer and use it in GitHub Desktop.
Save chranderson/d352cc97cca3eceeb3a437c4f45d7770 to your computer and use it in GitHub Desktop.
create indexed array by count
const createArray = count => Array(count).fill().map((x, i) => i)
const tenItemArray = createArray(10)
console.log(tenItemArray)
// [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment