span()

Creates an array with the span of numbers going from first and ending at last if possible depending on the specified step value.

This function is valid in v2.10.0 to v2.24.3. This function has been downloaded 81 times.

Parameters

{number} first
First number to be processed for the returned array.
{number} last
Last number to be processed for the returned array.
{number=} opt_step Optional, Default:1
Defaults to 1 if not given or if 0 or NaN is specified. The difference between each subsequent number to be processed for the returned array.
{Function=} opt_mapper Optional
Function to call for each number in the sequence and whose return value will be used as the value added to the returned array. If specified this function will be called for every number in the span, receiving it as the one and only argument.

Returns

{Array}
An array containing the sequence of numbers starting at first and ending at last. If first is less than last and opt_step is less than 0 or if last is less than first and opt_step is greater than 0 an empty array will be returned. If opt_mapper is given the array will contain the sequence of mapped.