_.rangeRight

_.rangeRight([start=0], end, [step=1])

This method is like _.range except that it populates values in descending order.

Since

4.0.0

Arguments

  1. [start=0] (number): The start of the range.
  2. end (number): The end of the range.
  3. [step=1] (number): The value to increment or decrement by.

Returns

(Array): Returns the range of numbers.

Example

_.rangeRight(4);
// => [3, 2, 1, 0]
 
_.rangeRight(-4);
// => [-3, -2, -1, 0]
 
_.rangeRight(1, 5);
// => [4, 3, 2, 1]
 
_.rangeRight(0, 20, 5);
// => [15, 10, 5, 0]
 
_.rangeRight(0, -4, -1);
// => [-3, -2, -1, 0]
 
_.rangeRight(1, 4, 0);
// => [1, 1, 1]
 
_.rangeRight(0);
// => []
doc_Lodash
2016-11-27 16:39:56
Comments
Leave a Comment

Please login to continue.