Skip to content

Instantly share code, notes, and snippets.

@electerious
Created September 16, 2017 13:54
Show Gist options
  • Save electerious/ccc39fb6fdda6d222a736c5007302590 to your computer and use it in GitHub Desktop.
Save electerious/ccc39fb6fdda6d222a736c5007302590 to your computer and use it in GitHub Desktop.
Create an array with a specified length
const createArray = (length) => Array.apply(null, Array(length))
@electerious
Copy link
Author

electerious commented Sep 16, 2017

Example:

createArray(2) // [undefined, undefined]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment