tc39 / proposal-array-last

A JavaScript TC39 Proposal for getting the last element from an array
311 stars 13 forks source link

Last as a getter/setter #4

Closed jridgewell closed 6 years ago

jridgewell commented 6 years ago

Instead of defining a getter/setter at -1 (very scary) or :-1 (which we don’t have precedent for), why not define last as a one?

ljharb commented 6 years ago

I suspect that would have significant web compat risk; most of the speculative polyfills define last as a function, not a getter.

keithamus commented 6 years ago

Personally I'm not especially fond of last as a getter, regardless of the web-compat issues. A last getter was floated a while ago (tc39/ecma262#36) and stalled for web-compat issues.

keithamus commented 6 years ago

Closing this. The Readme has been updated to reflect the current state of this proposal which features Array.prototype.end getter/setter.