Module: range

Methods

(inner) range(start, end, incrementopt, singlesopt, excludeopt) → {Array.<number>}

Returns a list of numbers within a given start and end point.

Parameters:
NameTypeAttributesDefaultDescription
startnumber

The number to start the list with

endnumber

The number to end the list with

incrementnumber<optional>
1

The amount added to the start to increase the list

singlesboolean<optional>
false

If true, will return a list containing arrays of individual numbers.

excludeArray.<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]))