This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis
I just saw that Array.prototype.at
will ship in Chrome 89 and Firefox 85. How do I know? I'm watching the MDN browser combat data repo on GitHub. ?
const numbers = [1, 2, 3];
// old way to access array elements from the end
numbers[numbers.length - 1]; // 3
// new way to access array elements from the end
numbers.at(-1); // 3
That's a welcome addition to the language! ?
Additional resources:
Reply to Stefan
This content originally appeared on Stefan Judis Web Development and was authored by Stefan Judis

Stefan Judis | Sciencx (2021-01-16T23:00:00+00:00) Array.prototype.at is on its way (#note). Retrieved from https://www.scien.cx/2021/01/16/array-prototype-at-is-on-its-way-note/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.