Creates a slice of array with n elements taken from the end.
array
n
The array to query.
Optional
The number of elements to take.
Returns the slice of array.
5.6.0
takeRight([1, 2, 3])// => [3]takeRight([1, 2, 3], 2)// => [2, 3]takeRight([1, 2, 3], 5)// => [1, 2, 3]takeRight([1, 2, 3], 0)// => [] Copy
takeRight([1, 2, 3])// => [3]takeRight([1, 2, 3], 2)// => [2, 3]takeRight([1, 2, 3], 5)// => [1, 2, 3]takeRight([1, 2, 3], 0)// => []
Creates a slice of
array
withn
elements taken from the end.