ECMAScript Proposal: .at() method on all the built-in indexables
#15 · 2021-01-28 · JavaScriptproposal to add an
.at()
method to all the basic indexable classes (Array, String, TypedArray)
— Proposal
Currently at Stage 3 and not implemented in browsers.
['a', 'b', 'c'].at(0); // evaluates to 'a'
['a', 'b', 'c'].at(-1); // evaluates to 'c'
'string'.at(1); // evaluates to 't'
'string'.at(-2); // evaluates to 'n'