takeRight

Modified on Fri, 18 Aug 2023

Description

Create a slice of `array` with `n` elements taken from the end.

Syntax

takeRight(array, n)

Parameters

Input ParameterTypeDescription
arrayArrayThe array to query.
nnumberThe number of elements to take.

Return value

Type
Array<any>

Sample

ExampleResultDescription
takeRight([1, 2, 3],2)[2, 3]Returns an array with 2 elements taken from the end

To view all the List functions, click here.

See Also