Expressions and patterns

Class extends clause

Try the free JavaScript compiler

For ordinary class inheritance from a constructor, sets the derived constructor prototype to the base constructor and the derived instance prototype to the base prototype. extends null is a separate case.

Formal Syntax & Structure

javascript syntaxjavascript
class Child extends Parent { /* body */ }

Working Example

Example Snippetjavascript
class B{}class C extends B{}console.log(Object.getPrototypeOf(C.prototype)===B.prototype);
JavaScript Reference