Skip to content

Instantly share code, notes, and snippets.

@tonylea
Created April 10, 2016 18:29
Show Gist options
  • Save tonylea/ffaf65d37539223a669c30fef3cb6506 to your computer and use it in GitHub Desktop.
Save tonylea/ffaf65d37539223a669c30fef3cb6506 to your computer and use it in GitHub Desktop.
Create a array filled with range of numbers
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