Created
April 10, 2016 18:29
-
-
Save tonylea/ffaf65d37539223a669c30fef3cb6506 to your computer and use it in GitHub Desktop.
Create a array filled with range of numbers
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
function rangedArray(start, end){ | |
if (arguments.length === 1) { | |
end = start; | |
start = 0; | |
} | |
end = end || 0; | |
var step = 1; | |
for (var result = []; ((end - start) * step) > 0; start += step) { | |
result.push(start); | |
} | |
result.push(end); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment