Options
All
  • Public
  • Public/Protected
  • All
Menu

Module dropRight

Index

References

Functions Array

References

Renames and re-exports dropRight

Array Functions

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

    since

    5.16.0

    example
    dropRight([1, 2, 3])
    // => [1, 2]

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

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

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

    Type parameters

    • T

    Parameters

    • array: T[]

      The array to query.

    • n: number = 1

      The number of elements to drop.

    Returns T[]

    Returns the slice of array.