I see that in step 13 of the [[Construct]] method of ordinary functions (
https://tc39.github.io/ecma262/#sec-ecmascript-function-objects-construct-argumentslist-newtarget),
the value resulted from the evaluation of the function body is checked and
if the constructor is a derived constructor, the value cannot be a
primitive different from undefined. Why isn't the same check performed if
the constructor is a base constructor?

Example of code that, when executed in the Chrome console, throws:

```
(function () {
'use strict';

class A {
  constructor() {
    return 4;
  }
}

class B extends A {
  constructor() {
    super();

    return 2;
  }
}

new B();
})();
```
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to