Timeline for How to create an array containing 1...N
Current License: CC BY-SA 3.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 30, 2019 at 0:16 | comment | added | Robin | @kube - if you care about the global, you can shave 2 whole chars off your for(var a=[]... version: (function(n,a){for(a=[];n--;a[n]=n+1);return a})(10) | |
| May 23, 2017 at 12:02 | history | edited | URL Rewriter Bot | replaced http://stackoverflow.com/ with https://stackoverflow.com/ | |
| Aug 4, 2016 at 17:33 | comment | added | sapy | you missed the Code golf(competition to solve a particular problem in the fewest bytes of source code) part in the answer :) | |
| Aug 4, 2016 at 17:09 | comment | added | kube | This creates a global variable a. The loop should be for(var a=[];n--;a[n]=n+1) | |
| Jul 15, 2016 at 19:34 | comment | added | sapy | (new Array(10)).keys() , returns ArrayIterator {} , not the array | |
| Jul 15, 2016 at 9:09 | comment | added | Guy | Webstorm suggests (new Array(10)).keys(), is it right? | |
| May 25, 2016 at 18:19 | comment | added | Greg | isn't this 0-10? [...Array(10).keys()] | |
| Apr 30, 2016 at 2:21 | history | edited | sapy | CC BY-SA 3.0 | deleted 26 characters in body |
| Apr 11, 2016 at 5:07 | history | edited | sapy | CC BY-SA 3.0 | es6 and es5 |
| Apr 10, 2016 at 18:51 | history | edited | sapy | CC BY-SA 3.0 | deleted 1 character in body |
| Mar 13, 2016 at 9:52 | history | edited | sapy | CC BY-SA 3.0 | added 181 characters in body |
| Feb 19, 2016 at 16:04 | history | edited | sapy | CC BY-SA 3.0 | added 32 characters in body |
| Feb 19, 2016 at 15:50 | history | answered | sapy | CC BY-SA 3.0 |