Function rangeRight

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

    Parameters

    • start: number

      The start of the range.

    • Optionalend: number

      The end of the range.

    • Optionalstep: number

      The value to increment or decrement by.

    Returns number[]

    Returns the range of numbers.

    5.7.0

    [[inRange]],[[range]]

    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)
    // => []