JavaScript 2025 · Arrays
Get the last item
Use a negative index with at().
const last = items.at(-1);
Official JavaScript 2025 documentation
JavaScript 2025 · Arrays
Use a negative index with at().
const last = items.at(-1);
Official JavaScript 2025 documentation
Was this page helpful?