The array to query.
Optional
n: numberThe number of elements to take.
Optional
guard: anyReturns the slice of array
.
5.6.0
take([1, 2, 3])
// => [1]
take([1, 2, 3], 2)
// => [1, 2]
take([1, 2, 3], 5)
// => [1, 2, 3]
take([1, 2, 3], 0)
// => []
Creates a slice of
array
withn
elements taken from the beginning.