Skip to content

Instantly share code, notes, and snippets.

@JoseHdez2
Created November 4, 2019 23:56
Show Gist options
  • Save JoseHdez2/6428cd6d528d13d6ec72dd72b453d5bf to your computer and use it in GitHub Desktop.
Save JoseHdez2/6428cd6d528d13d6ec72dd72b453d5bf to your computer and use it in GitHub Desktop.
range in ECMAscript 6
// https://www.westworld.be/range-in-es6/
//range from 0 => n
const range =[...Array(n).keys()];
console.log(range);
//Range from start => end
const rangexy = (start, end) => Array.from({length: (end - start)}, (v, k) => k + start);
console.log(rangexy(0,10));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment