▲ Create Range 0...N easily using one line at github.com▼3 up and 0 down, posted by loverajoel 3599 days ago 2 comments
synaestheory 3598 days ago. link 1 point ▲ ▼Extend this to create any int range by wrapping it like so... `const range = (min, max) => Array.apply(null,{length:max - min + 1}).map((val,i) => min + i)` Excellent usage of Array.apply
That `Array.apply(null, { length: n })` trick is cunning!Extend this to create any int range by wrapping it like so... `const range = (min, max) => Array.apply(null,{length:max - min + 1}).map((val,i) => min + i)` Excellent usage of Array.apply