nth
Retrieves the element at a specified index from an array.
(nth index arr)
Returns
The function returns the element at the specified index in the given array.
Parameters
index (number) - the index of the element to retrieve from the array
arr (array) - the array from which the element is to be retrieved.
Examples
(nth 1 [1, 2, 3, 4, 5])
;;=> 2
(nth -1 ["John", "Pop", "Maria"])
;;=> Maria
Was this helpful?