Options
All
  • Public
  • Public/Protected
  • All
Menu

Module takeRight

Index

References

Functions Array

References

Renames and re-exports __type

Array Functions

  • takeRight<T>(array: ArrayLike<T>, n?: number): T[]
  • Creates a slice of array with n elements taken from the end.

    since

    5.6.0

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

    Type parameters

    • T

    Parameters

    • array: ArrayLike<T>

      The array to query.

    • Optional n: number

      The number of elements to take.

    Returns T[]

    Returns the slice of array.