super

The super keyword comes in three distinct flavors:

  • super() as a direct function invocation will call the superclass's constructor (that is, its object's [[Prototype]] constructor) and is only valid to call within a constructor. It also must be called before trying to access this as it is super() itself that'll initiate the execution context.
  • super.property will access a property on the superclass (that is, the [[Prototype]]), and is only valid to reference within a constructor or method defined using the method definition syntax.
  • super.method() will invoke a method on the superclass (that is, the [[Prototype]]), and is only valid to call within a constructor or method defined using the method definition syntax.

The super keyword was ...

Get Clean Code in JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.