Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
super return value
let x;
class A {
constructor() {
this.a = true;
// explictly returns this
return this;
}
}
class B extends A {
constructor() {
x = super();
}
}
new B();
assert(x !== void 0);
let x;
class A {
constructor() {
this.a = true;
// implicitly returns this?
}
}
class B extends A {
constructor() {
x = super();
}
}
new B();
assert(x === void 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment