jskatas.org Continuously Learn JavaScript. Your Way.

Class: extends

How to do inheritance, using extends.

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.

Classes can inherit from another using extends

the default super class is Object

  • a class A is an instance of Object
  • when B extends A, B is also instance of Object
  • a class can extend null, and is not an instance of Object

instance of

  • when B inherits from A, new B() is also an instance of A
  • extend over multiple levels