Skip to content

array.Function.drop

soetas edited this page Nov 30, 2024 · 2 revisions

estdlib v0.1.2 / array / drop

Function: drop()

drop<T>(array, n): void

Creates a slice of array with n elements dropped from the beginning

Type Parameters

T

Type of objects the array contains

Parameters

array: T[]

The array to query

n: number = 1

The number of elements to drop

Returns

void

  • Returns the slice of array

Since

0.1.2

See

source

Example

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

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

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

drop([1, 2, 3], 0)
// => [1, 2, 3]
Clone this wiki locally