NewDash

    Function takeRight

    • Creates a slice of array with n elements taken from the end.

      Type Parameters

      • T

      Parameters

      • array: ArrayLike<T>

        The array to query.

      • Optionaln: number

        The number of elements to take.

      Returns T[]

      Returns the slice of array.

      5.6.0

      takeRight([1, 2, 3])
      // => [3]

      takeRight([1, 2, 3], 2)
      // => [2, 3]

      takeRight([1, 2, 3], 5)
      // => [1, 2, 3]

      takeRight([1, 2, 3], 0)
      // => []
    MMNEPVFCICPMFPCPTTAAATR