A couple of disadvantages to it are:
- It's a very new method. Older browsers will not be able to understand your code if you use it, unless you include a polyfill - so make sure you include one..
- On a completely different track, since it's such a new method, I wouldn't be surprised if a substantial number of developers haven't heard about it - using
.atmay confuse some of them (and cause them to have to look it up). Not that this means that you shouldn't use it, but it's something to keep in mind.
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › at
Array.prototype.at() - JavaScript | MDN
The at() method of Array instances takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the array.
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array
Array - JavaScript | MDN
2 weeks ago - The Array object, as with arrays in other programming languages, enables storing a collection of multiple items under a single variable name, and has members for performing common array operations.
ECMAScript 2022 introduces at() method in Array, String, TypedArray
Wow. Someone woke up on the wrong side of the bed. Let’s have a more productive conversation, I’ll start: I think tiny changes like this are very welcome. One less thing I need to deduce in my head, one less test case I need to write I’m all here for. More on reddit.com
Using Array.at(index) instead of Array[index] in JavaScript - Stack Overflow
It seems more useful than squared brackets annotation arr[i] since there is an option to specify index starting from the end of an array, for example: arr.at(-1) which would return the last member of arr array. Also, it seems more appropriate for method chaining. More on stackoverflow.com
Implement .at() Array Method
@newcoder I believe that at allows ... of the array. I need to look up the actual specification... but if that's the case then return this[index]; is incorrect as it doesn't handle negative indexes (IIRC the default indexer is only defined for nonnegative indexes). ... You don't need a for loop at all with JS' Array type ... More on stackoverflow.com
Why do you need to know about the JavaScript Array at() method?
While I'm looking forward to the at() method, as I love negative indexes (which is why I use slice() so much), calling it a "game changer" is a bit of a stretch. It isn't giving us anything we can't already do, it is just making it shorter, by using arr.at(-n) instead of arr[arr.length - n]. Not everything can, or should be, a game-changer, because then the game is changing way too much. Some things are just "nice". More on reddit.com
W3Schools
w3schools.com › jsref › jsref_array_at.asp
W3Schools.com
This is not possible in JavaScript, because [] is used for accessing both arrays and objects. obj[-1] refers to the value of key -1, not to the last property of the object. The at() method was introduced in ES2022 to solve this problem.
Reddit
reddit.com › r/javascript › ecmascript 2022 introduces at() method in array, string, typedarray
r/javascript on Reddit: ECMAScript 2022 introduces at() method in Array, String, TypedArray
February 24, 2022 - It might not be clear if you're code looks like foo[x][y]. If you have the rule "only use [] for objects" then foo.at(x)[y] is more clear. I think the negative indexes are a more minor benefit than this. ... It's not meant for iteration. It does help with clarity, but the intent is be similar to Python and make reverse lookups easier. For many years, programmers have asked for the ability to do "negative indexing" of JS Arrays, like you can do with Python.
Top answer 1 of 6
9
A couple of disadvantages to it are:
- It's a very new method. Older browsers will not be able to understand your code if you use it, unless you include a polyfill - so make sure you include one..
- On a completely different track, since it's such a new method, I wouldn't be surprised if a substantial number of developers haven't heard about it - using
.atmay confuse some of them (and cause them to have to look it up). Not that this means that you shouldn't use it, but it's something to keep in mind.
2 of 6
8
It is not disadvantage but you must keep in mind that:
Array.prototype.at() is ONLY ACCESSOR which means that you can't use it to (re)set some value inside array
By combining at() with with(), you can both read and write (respectively) an array using negative indices
MDN
On the other hand Array[index] is BOTH ACCESSOR AND MODIFIER
Go Make Things
gomakethings.com › the-array.prototype.at-method-in-vanilla-javascript
The Array.prototype.at() method in vanilla JavaScript | Go Make Things
July 13, 2022 - Today, I wanted to quickly share the Array.prototype.at() method: how it works, and when you might use it. Let’s dig in! Getting an item from an array by its index Let’s imagine you have an array of wizards, like this. let wizards = [ 'Merlin', 'Gandalf', 'Ursula', 'Radagast', 'Morgana' ]; Using bracket notation, you can get an item by its index (remember, array indexes start at 0). // returns "Ursula" let ursula = wizards[2]; // returns "Morgana" let morgana = wizards[4]; Here’s a demo.
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-arrays
JavaScript Arrays - GeeksforGeeks
The indexing starts at 0, so the first element is at position 0, the second at position 1, and so on. Arrays can hold any type of data-such as numbers, strings, objects, or even other arrays—making them a flexible and essential part of JavaScript programming.
Published October 3, 2025
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › some
Array.prototype.some() - JavaScript | MDN
2 weeks ago - If an existing, yet-unvisited element of the array is changed by callbackFn, its value passed to the callbackFn will be the value at the time that element gets visited. Deleted elements are not visited. Warning: Concurrent modifications of the kind described above frequently lead to hard-to-understand code and are generally to be avoided (except in special cases). The some() method is generic. It only expects the this value to have a length property and integer-keyed properties. The following example tests whether any element in the array is bigger than 10. js ·
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › includes
Array.prototype.includes() - JavaScript | MDN
const array = [1, 2, 3]; console.log(array.includes(2)); // Expected output: true const pets = ["cat", "dog", "bat"]; console.log(pets.includes("cat")); // Expected output: true console.log(pets.includes("at")); // Expected output: false · js · includes(searchElement) includes(searchElement, fromIndex) searchElement ·
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › TypedArray › at
TypedArray.prototype.at() - JavaScript | MDN
July 10, 2025 - The at() method of TypedArray instances takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the typed array. This method has the same algorithm as Array.prototype.at().
YouTube
youtube.com › watch
At Array Method Explained | JavaScript - YouTube
This is the Array.prototype.at() explained. The at() method of Array instances takes an integer value and returns the item at that index, allowing for positi
Published February 11, 2024