CKTIS / JavaScript
super — base constructor and inherited method access
The super keyword calls a base constructor or accesses properties through the prototype of the object where a method was defined. A super.method() call preserves the current this value.
Version: ECMAScript and Web APIs; exact feature edition and browser support reviewed per entry; Node 24 in repository does not prove browser API support
Syntax
super(...args)
super.property
super[expression]super is a reserved keyword, not a variable referring to a “parent object”. Bare super cannot be used as a value. Its basic forms are super(...args), super.property, and super[expression].
super(...args) calls the base constructor. Once the base constructor returns an object, super() binds the derived constructor’s this to that object, then runs the derived class’s instance field initializers. Reading the derived constructor’s this before it is bound throws a ReferenceError. A field initializer can, however, invoke an arrow function created in the derived constructor that reads the constructor’s this before super() returns. As an exception, a derived constructor can return another object without calling super().
Property lookup starts at the current prototype of the method’s home object (the object where the method was defined). In a typical class that extends another class, the default starting point is the base class prototype for instance methods and the base constructor for static methods. For static methods in an ordinary class with no extends clause, the default starting point is Function.prototype. super.text() calls the resolved method with the current this, not a separate base instance. Read properties stored by a constructor as this.name through this.name, not super.name.
Property access through super also works in object literal methods. A nested arrow function can inherit this context; an ordinary nested function cannot. In the example, super(name) initializes the name, and super.text() uses it for the same instance.
Examples
class Greeting {
constructor(name) {
this.name = name;
}
text() {
return `Hello, ${this.name}`;
}
}
class LoudGreeting extends Greeting {
constructor(name) {
super(name);
this.suffix = '!';
}
text() {
return super.text() + this.suffix;
}
}
console.log(new LoudGreeting('Ada').text());Result
Hello, Ada!
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.