Skip to content

Classes

ES6 classes are syntactic sugar over JavaScript’s existing prototypal inheritance. They provide a cleaner, more familiar syntax for creating constructor functions and managing prototypes.

  • Write class declarations and expressions
  • Understand constructors and instance initialization
  • Use extends and super for inheritance
  • Implement getters, setters, and computed properties
  • Use static methods and fields
  • Understand private fields with #
flowchart TD
A["Class Definition"]
A --> B["constructor()"]
A --> C["Instance Methods"]
A --> D["Static Methods"]
A --> E["Getters/Setters"]
A --> F["Private Fields (#)"]
B --> G["Called with new"]
C --> H["Shared via prototype"]
D --> I["Called on class itself"]
E --> J["Computed properties"]
F --> K["Truly private"]
TopicDescriptionEst. Time
Class Declarationclass syntax, class expressions10 min
ConstructorInitialization, super()10 min
extends & superInheritance, method overriding15 min
Getters & SettersComputed properties10 min
Static MembersStatic methods and fields10 min
Private Fields# prefix for true privacy15 min
  • Functions and constructors
  • Prototypes and prototype chain
  • Objects and property descriptors
Class Declaration → Constructor → extends & super → Getters & Setters → Static Members → Private Fields