Since Array inherits from Object, it can have any key, including the key "-1". So something like list[-1] would break compatibility as users can now already assign values to the index -1.
If you want a short way to access the last element, it should probably be a function in the Array prototype. Something like list.last(). Regards, Sander 2016-01-22 18:53 GMT+01:00 RacerD123 <[email protected]>: > In other programming languages such as python, you can specify the last > element of a list with "list[-1]" but in javascript you have to do > "list[list.length-1]". Is there maybe a way to make this feature in > javascript? > > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

