- Source:
Methods
(inner) range(start, end, incrementopt, singlesopt, excludeopt) → {Array.<number>}
Returns a list of numbers within a given start and end point.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
start | number | The number to start the list with | ||
end | number | The number to end the list with | ||
increment | number | <optional> | 1 | The amount added to the start to increase the list |
singles | boolean | <optional> | false | If true, will return a list containing arrays of individual numbers. |
exclude | Array.<number> | <optional> | A list of numbers that should not be in the range |
- Source:
Returns:
A list of numbers within the start and end values
- Type
- Array.<number>
Examples
Example usage of the 'range' function
// returns [1,2,3,4,5,6,7,8,9,10]
console.log(range(1,10));
Example usage of the 'range' function with custom increment
// returns [1,3,5,7,9,10]
console.log(range(1,10,2));
Example usage of the 'range' function with excluded numbers
// returns [1,3,4,5,6,9,10]
console.log(range(1,10,1,[2,7,8]))