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 ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.