#take
Returns the leading elements of an array, up to the specified count.
#take(array, count)Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
array |
path | array |
The source array. |
count |
integer |
How many elements to take. |
Returns
Section titled “Returns”array
Examples
Section titled “Examples”First two
Section titled “First two”{ "numbers": [ 1, 2, 3, 4 ]}{ "result": "#take($.numbers, 2)"}{ "result": [ 1, 2 ]}Related
Section titled “Related”#skip · #takeWhile · #slice
