Skip to content

Instantly share code, notes, and snippets.

@nicksteffens
Last active January 29, 2016 00:28
Show Gist options
  • Select an option

  • Save nicksteffens/834967612f06065d2335 to your computer and use it in GitHub Desktop.

Select an option

Save nicksteffens/834967612f06065d2335 to your computer and use it in GitHub Desktop.
This will create and array of numbers, starting from min and max with eh numbers in-between being incremented a consistent amount
function createMinMaxArrayWithIncrement(minNum, maxNum, increment) {
var values = [minNum, maxNum],
nextMin = (minNum + increment) - (minNum % increment);
for(var i = nextMin; i < maxNum; i += increment) {
values.splice(values.length -1, 0, i);
}
return values;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment