mdn/js/2_javascript_objects/3_classes_in_javascript

3_classes_in_javascript

dz / mdn / js / 2_javascript_objects / 3_classes_in_javascript

Summary

Classes in JavaScript

Node Tree

Nodes

class_keyword
content class keyword
children extends_keyword (related), constructor

constructor
content Constructor
children default_if_cons_omitted, super
parents class_keyword

default_if_cons_omitted
content If constructor omitted, default one will be created
parents constructor

encapsulation
content Encapsulation
children private_data_prop

inheritance
content Inheritance
children extends_keyword, super

private_data_prop
content #foo: private data property
children private_methods (also start with "#")
parents encapsulation

extends_keyword
content extends keyword
parents class_keyword, inheritance

super
content super(): class superclass constructor
parents inheritance, constructor

private_methods
content private methods start with "#"
parents private_data_prop