Closed
Description
- Version: v8.4.0
- Platform: Linux hostname 4.4.0-93-lowlatency test-require-resolve: use case insensitive compare #116-Ubuntu SMP PREEMPT Fri Aug 11 22:13:00 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
As of node v8.4.0, assigning a value to the array index '' causes a duplicate entry to be created. The duplicate disappears (and cannot be recreated) as soon as a value is assigned to a numerical index.
let x = [];
x[''] = 'foo';
console.log(x);
// [ '': 'foo', '': 'foo' ]
console.log(x[0]);
// undefined
x[0] = 'bar';
console.log(x);
// [ 'bar', '': 'foo' ]
x[''] = 'baz';
console.log(x);
// [ 'bar', '': 'baz' ]