Created
November 5, 2015 14:47
-
-
Save jsangilve/99db6615f692dc5c5545 to your computer and use it in GitHub Desktop.
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
let range = function (start, end, step = 1) { | |
if (arguments.length === 1) { | |
([start, end] = [0, start]); | |
} | |
const length = Math.ceil((end - start) / step); | |
if (length <= 0) return []; | |
return Array.from(new Array(length), (elem, index) => start + (index * step)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment