Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • \$\begingroup\$ MDN says that eval is the shortest. \$\endgroup\$ Commented Jan 23, 2013 at 13:30
  • 6
    \$\begingroup\$ eval.apply(0,Array(1e6)) saves 3 chars, you can even go with 9e9 at no cost \$\endgroup\$ Commented Feb 2, 2014 at 22:30
  • 1
    \$\begingroup\$ apply is a standard ECMAScript feature. There is nothing browser dependent. Unless you are talking about really old browsers, but this wouldn't work in hypothetical Netscape 2 with apply anyway, because Array class doesn't exist in Netscape 2. \$\endgroup\$ Commented Apr 2, 2014 at 12:02
  • 1
    \$\begingroup\$ new shortest in ES6: eval(...Array(9e9)) \$\endgroup\$ Commented Jan 25, 2016 at 7:36
  • 1
    \$\begingroup\$ Probably non-standard, throws in Chrome from the console. dir.apply(0,Array(1e7)); \$\endgroup\$ Commented Nov 21, 2016 at 22:05