Negative indexes
Logan Smyth
loganfsmyth at gmail.com
Tue Feb 2 00:51:32 UTC 2016
Felipe, this has been discussed in the other thread that was just linked:
https://esdiscuss.org/topic/javascript-language-feature-idea. `arr[-1]` is
not a workable solution because it could break existing code.
On Mon, Feb 1, 2016 at 4:43 PM, Felipe Nascimento de Moura <
felipenmoura at gmail.com> wrote:
> Yes, that would do what he wants...but I like the idea of using
> ```arr[-1]```, though!!
> It just makes sense, to me!
> Specially if you want to use reversed loops, for example.
>
>
>
> On Mon, Feb 1, 2016 at 5:46 PM C. Scott Ananian <ecmascript at cscott.net>
> wrote:
>
>> `arr.slice(-1)[0]` does what you want, I think.
>> --scott
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160201/a8f7eda2/attachment.html>
More information about the es-discuss
mailing list