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`?).

Bob

On Tue, Apr 19, 2016 at 10:47 AM, Bruno Jouhier <[email protected]> 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.
> Consider:
>
> ``` javascript
> 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
> it.
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to