JavaScript Language feature Idea

Michał Wadas michalwadas at gmail.com
Tue Apr 19 14:37:19 UTC 2016


2016-04-19 10:40 GMT+02:00 Jordan Harband <ljharb at gmail.com>:

> (note that `Set#get(-1)` does not retrieve the last item in the set, for
> example).
>


Because Set.prototype.get doesn't even exist. And Set by definition is an
unordered collection, so there is no "last" element.

I think Array.prototype.get and Array.prototype.set are the way to go - it
should not break backward compatibility. And it's consistent with
Array.prototype.slice behaviour.


BTW, this was discussed 3 years ago:
https://esdiscuss.org/topic/array-prototype-last
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160419/192cda3c/attachment.html>


More information about the es-discuss mailing list