ES2022 JavaScript at() Method Last Updated : 23 Jul, 2025 Comments Improve Suggest changes 2 Likes Like Report Before getting into at() method we should know about what arrays, strings and Typed array in JavaScript is and also how to access arraysJavaScript at() Method: Now, usually we access array elements via their indexes, and we know that the array index starts from 0. Now if we want to access the 102 value form above the house number array we can easily retrieve it with index = 1 which is a positive index. Now we want to access the last element of the array we cannot specify directly -1 as before ES22 the negative indexing was not supported so what we need to do is write an array name specify the length function and then do -1 e.g. array_name.length-1 but after ES22 release negative index supports indexable classes.Basically, at() methods are used to access elements of an array by specifying or passing negative indexing.Syntax:anyVar.at(index);Parameters: index - This method accepts a single parameter that holds the index of the array element. The index may have positive or negative, if it is negative then it gives from the last index elements.Return value: This method returns the character at the specified index. The index starts from 0.Example 1: JavaScript // array const array1 = [45, 46, 47, 48, 49] console.log(array1.at(-1)); console.log(array1.at(1)); Output: 4946Example 2: JavaScript const strarr = ["apple","ball", "cow", "dog", "elephant", "fish" ]; console.log(strarr.at(-1)); console.log(strarr.at(-3)); Output : fish dogAdvantages of using at() method:Improves readability of code as we do not need to specify array_name repeatedly.No need to use the length property to access the negative index. Supported Browsers:Chrome 38 and aboveEdge 12 and aboveFirefox 24 and aboveOpera 25 and aboveSafari 8 and above Create Quiz Comment D devendrasalunke Follow 2 Improve D devendrasalunke Follow 2 Improve Article Tags : JavaScript Web Technologies Arrays JavaScript-ES strings JavaScript-Methods +2 More Explore JavaScript BasicsIntroduction to JavaScript4 min readVariables and Datatypes in JavaScript6 min readJavaScript Operators5 min readControl Statements in JavaScript4 min readArray & StringJavaScript Arrays7 min readJavaScript Array Methods7 min readJavaScript Strings5 min readJavaScript String Methods9 min readFunction & ObjectFunctions in JavaScript5 min readJavaScript Function Expression3 min readFunction Overloading in JavaScript4 min readObjects in JavaScript4 min readJavaScript Object Constructors4 min readOOPObject Oriented Programming in JavaScript3 min readClasses and Objects in JavaScript4 min readWhat Are Access Modifiers In JavaScript ?5 min readJavaScript Constructor Method7 min readAsynchronous JavaScriptAsynchronous JavaScript2 min readJavaScript Callbacks4 min readJavaScript Promise4 min readEvent Loop in JavaScript4 min readAsync and Await in JavaScript2 min readException HandlingJavascript Error and Exceptional Handling6 min readJavaScript Errors Throw and Try to Catch2 min readHow to create custom errors in JavaScript ?2 min readJavaScript TypeError - Invalid Array.prototype.sort argument1 min readDOMHTML DOM (Document Object Model)8 min readHow to select DOM Elements in JavaScript ?3 min readJavaScript Custom Events4 min readJavaScript addEventListener() with Examples9 min readAdvanced TopicsClosure in JavaScript4 min readJavaScript Hoisting6 min readScope of Variables in JavaScript3 min readJavaScript Higher Order Functions7 min readDebugging in JavaScript4 min read Like