Returns up to the specified number of trailing elements from source.
Type of elements within source.
The source iterable.
Number of elements to keep from the end; values less than or equal to zero produce an empty sequence.
A deferred sequence containing at most count elements from the end of source.
The implementation buffers up to count elements to determine the tail, so memory usage grows with count. The source must be finite.
const numbers = [1, 2, 3, 4, 5];const lastTwo = takeLast(numbers, 2).toArray();console.log(lastTwo); // [4, 5]const emptyTakeLast = takeLast(numbers, 0).toArray();console.log(emptyTakeLast); // [] Copy
const numbers = [1, 2, 3, 4, 5];const lastTwo = takeLast(numbers, 2).toArray();console.log(lastTwo); // [4, 5]const emptyTakeLast = takeLast(numbers, 0).toArray();console.log(emptyTakeLast); // []
Returns up to the specified number of trailing elements from source.