rtm at gol.com
Tue Apr 19 05:29:17 UTC 2016
Please go back and read the existing threads. We've been over this
territory ad nauseum.
Yes, of course `array[-1]` would break the web and that's why no one is
seriously proposing that.
As already discussed extensively, `Array#last` may be an option, but it
could collide with libraries or other code which extends `Array.prototype`,
and they seem too specialized (why not also `lastButOne`?).
On Tue, Apr 19, 2016 at 10:47 AM, Bruno Jouhier <bjouhier at gmail.com> wrote:
> Why new syntax here? This is just a method that's missing: `array.last(n)`.
> `array[-1]` would break things and it is difficult to find out where.
> for (var i = array.length - 1; array[i]; i--) doSomething(array[i]);
> Not the best way to write such a loop but changing `array[-1]` would break
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss