Description

Create a slice of `array` with `n` elements taken from the beginning.

Syntax

take(array, n)

Parameters

Input ParameterTypeDescription
arrayArrayThe array to query.
nnumberThe number of elements to take.

Return value

Type
Array<any>

Sample

ExampleResultDescription
take([1, 2, 3], 2)[1, 2]Returns an array with 2 elements

To view all the List functions, click here.