That would break backward compatibility; ```js var a = ['a']; a['-1'] = 'test'; Object.keys(a) // ['0', '-1'] ```
On Sun, Apr 17, 2016 at 11:53 AM, Biju <[email protected]> wrote: > We cam make this simpler, in Javascript Array.slice() already accept > negative index. > Developers from Javascript and other languages are familiar with > negative value for index parameter. > So why cant we make array accept negative index. > > in comparison with Bob Myers' proposal > > > ``` > > [1,2,3](-1) > > ``` > > will become > > ``` > [1,2,3][-1] > ``` > > This will also allow us to set value using negative index, > example > > var array_data = [1, 2, 3, 4]; > array_data[-1] = 5; > array_data[-3] = 6; > > // now array_data is [1, 6, 3, 5] > _______________________________________________ > 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

