Getting last item from Array
Less than 1 minute
Getting last item from Array
Modules
Types
interface Array<T> {
get lastItem(): T;
set lastItem(value: T);
get lastIndex(): number;
}
Entry points
core-js/proposals/array-last
core-js/full/array/last-item
core-js/full/array/last-index
Example
[1, 2, 3].lastItem; // => 3
[1, 2, 3].lastIndex; // => 2
const array = [1, 2, 3];
array.lastItem = 4;
array; // => [1, 2, 4]