Skip to main content

Classes: Fields, Getters, Static and Inheritance

Learn Classes: Fields, Getters, Static and Inheritance (Phase 10 · Classes, Prototypes, OOP (Important), JavaScript) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Class syntax • class is syntax over prototypes: the constructor initialises instances; other methods live on the prototype. • extends creates a subclass; super(...) calls the parent constructor (must run before touching this ), super.method() calls a parent method. • static members belong to the class, not instances. Classes are not hoisted like functions and must be called with new .

More lessons in Phase 10 · Classes, Prototypes, OOP (Important)