Array.prototype.last()

Mathias Bynens mathiasb at opera.com
Tue May 13 23:48:53 PDT 2014


Previous discussion on this topic: http://esdiscuss.org/topic/array-prototype-last

We should look at how existing utility libraries handle this behavior and base any proposals on that IMHO. Underscore and Lo-Dash have [`_.first`](http://lodash.com/docs#first) and [`_.last`](http://lodash.com/docs#last), which both take an optional `callback` parameter, in which case all the first/last `n` elements for which `callback` returns a truthy value are returned. This seems like a sensible thing to add to the proposal.


More information about the es-discuss mailing list