Array at()
The JavaScript Array at() method takes an integer value (index) as a parameter and returns the element of that index. It allows positive and negative integers. For the negative integer, it counts back from the last element in the array.
Syntax:
at(index);
Example: This code shows the value extracted at the given index.
Javascript
const arr = [45, 32, 69, 21]; const index = 3; console.log(arr.at(index)); |
Output
21
ECMAScript 2021 (JS 2021/2022)
JavaScript in 2021/2022 continues to evolve, with ES2021/ES2022 bringing enhanced features like private class fields, promise improvements, and record data structures, boosting developer productivity and code quality.