Created
November 4, 2019 23:56
-
-
Save JoseHdez2/6428cd6d528d13d6ec72dd72b453d5bf to your computer and use it in GitHub Desktop.
range in ECMAscript 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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