Skip to content

Instantly share code, notes, and snippets.

@mamoo
Last active December 28, 2015 17:48
Show Gist options
  • Select an option

  • Save mamoo/e64dc274b94742de69e7 to your computer and use it in GitHub Desktop.

Select an option

Save mamoo/e64dc274b94742de69e7 to your computer and use it in GitHub Desktop.
Array initialization (ECMAScript 5)
//Initialize an array of x items with undefined values.
//cfr. http://www.2ality.com/2013/11/initializing-arrays.html
var x = 5;
Array.apply(null, Array(x));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment