super: Parent Access in JavaScript
super reaches the parent in two forms: super(...) as a constructor call (mandatory before this in derived constructors) and super.method() for parent method invocation (overrides extending rather than replacing behavior). In object literals, super similarly accesses the prototype — methods-only syntax, since the home-object reference needs method definitions.
Call super() with the arguments the parent requires, then specialize; call super.method() when overriding wraps rather than replaces (validation plus parent logic). Forgetting super() before this is a ReferenceError, not a subtle bug.
Construct parent first
super(name) in a derived constructor builds the base subobject — this is unusable until it runs.
Extend methods via super
render() { super.render(); this.extra(); } — parent behavior plus specialization, not either/or.
Missing super throws
Touching this before super() is a loud ReferenceError — the language enforces construction order.
Methods only
super works in method definitions (classes and literals) — arrow properties and detached functions lack home objects.
class Animal { constructor(name) { this.name = name; } label() { return "animal:" + this.name; }}class Dog extends Animal { label() { return super.label() + "!"; }}console.log(new Dog("Rex").label());Recommended resourcesAffiliate links · may earn us a commission
Recommended for learners
Practice what you learned
Re-implement each visualized algorithm in JavaScript yourself — building beats watching.