Artboard 16light, inspiration, solution, idea, innovation,ionicons-v5_logosGoogle Sheets iconSwift icon
Published at
Updated at
Reading time
1min
This post is a note that includes my thoughts about something I found online. Check it out yourself!

I just saw that Array.prototype.at will ship in Chrome 89 and Firefox 85. How do I know? I'm following 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! ๐ŸŽ‰

Update: one year after publishing this post and this new valuable Array method is almost ready for prime time! Here's the up-to-date MDN browser compat data:

MDN Compat Data (source)
Browser support info for Array.prototype.at()
chromechrome_androidedgefirefoxfirefox_androidsafarisafari_iossamsunginternet_androidwebview_android
929292909015.415.416.092

Additional resources:

Was this post helpful?
Yes? Cool! You might want to check out Web Weekly for more WebDev shenanigans. The last edition went out 4 days ago.

Related Topics

Related Articles