Last active
January 29, 2016 00:28
-
-
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
This file contains hidden or 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 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