JavaScript 2025 · Arrays

Get the last item

Use a negative index with at().

const last = items.at(-1);

Official JavaScript 2025 documentation

More arrays commands

All arrays commands · JavaScript 2025 cheatsheet

Was this page helpful?