first
arrayReturns the first element of an array
Syntax
first(array) Parameters
array (array) The array to get the first element from
Returns
any The first element of the array
Examples
Input:
[1, 2, 3] | first Output:
1 Input:
["apple", "banana", "cherry"] | first Output:
"apple" The first() function retrieves the first element from an array. It provides a convenient way to access the initial element without using array indexing.
Usage
This function is useful for getting the top result from sorted data, accessing the initial element of a sequence, or working with the beginning of a dataset.