The code below logs false in Chrome V8 but logs true in Babel. The feedback from Google said that logging false is how it is supposed to be while logging true is a bug of Babel. I looked into the ES6 specs and still couldn't understand the mechanism behind this. Any thoughts would be appreciated!
class NewObj extends Object{
constructor(){
super(...arguments); // In V8, after arguments === [{attr: true}]
// is passed as parameter to super(),
// this === NewObj{} in V8;
// but this === NewObj{attr: true} in Babel.
}
}
var o = new NewObj({attr: true});
console.log(o.attr === true);
super()
call is most certainly allowed to include an argument list, and the Object constructor is supposed to pay attention to its argument.true
.