shift()
shift<
T
>(arr
): [T
,T
[]]
Returns a tuple containing the first element (head) of the given array and the remaining elements of the array (tail).
Type Parameters
• T
Parameters
arr
T
[]
The element to get the head
/tail
of.
Returns
[T
, T
[]]
Remark
pure function
Example
shift([1, 2, 3, 4]);
// [1, [2, 3, 4, 5]]