jskatas.org Continuously Learn JavaScript. Your Way.

Class: super in method

Use of super inside a method.

Donate to NGO Julenka. Support Ukranians in need. Julenka is an NGO which my brother founded in 2011 to support Ukranian families and kids in need.

Inside a class use super to access parent methods

  • use of super without extends fails (already when transpiling)
  • super with extends calls the method of the given name of the parent class
  • when overridden a method does NOT automatically call its super method
  • super works across any number of levels of inheritance
  • accessing an undefined member of the parent class returns undefined