Function: rangeTo()
Returns a RangeIterable that yields the integers between start
and
end
including start
and end
.
Throws
if either start
or end
is not an integer.
Example
console.log([...rangeTo(0, 6)])
//=> [ 0, 1, 2, 3, 4, 5, 6 ]
console.log([...rangeTo(0, 6).step(2)])
//=> [ 0, 2, 4, 6 ]
rangeTo(start)
rangeTo<
Start
>(start
): <End
>(end
) =>RangeIterable
Returns a RangeIterable that yields the integers between start
and
end
including start
and end
.
Type Parameters
• Start extends number
Parameters
• start: Integer
<Start
>
Returns
Function
Type Parameters
• End extends number
Parameters
• end: Integer
<End
>
Returns
Throws
if either start
or end
is not an integer.
Example
console.log([...rangeTo(0, 6)])
//=> [ 0, 1, 2, 3, 4, 5, 6 ]
console.log([...rangeTo(0, 6).step(2)])
//=> [ 0, 2, 4, 6 ]
Defined in
rangeTo(start, end)
rangeTo<
Start
,End
>(start
,end
):RangeIterable
Returns a RangeIterable that yields the integers between start
and
end
including start
and end
.
Type Parameters
• Start extends number
• End extends number