Add a new method, named at(), to Array.prototype, String.prototype, and the TypedArray prototypes, that permit relative indexing with negative indices. ``` let arr = [1,2,3,4]; arr.at(-1); // Returns 4 ```

Motivation

Relative indexing via negative indices is a feature that enjoys popularity in other languages (e.g. Python) as well as having been requested by JS programmers.

Specification

Editor's draft

Status in Chromium

A-N/A


Enabled by default (tracking bug) in:

  • Chrome for desktop release 92
  • Chrome for Android release 92
  • Android WebView release 92

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

Owner

Last updated on 2021-06-20