Class
Classes are syntactic sugar over JavaScript's prototype-based inheritance, used to create objects with shared structure and behavior.
A class is a blueprint for creating objects that share properties and methods. Under the hood, JS classes are just a nicer syntax over the existing prototype-based inheritance system.
Inheritance (extends / super)
Class expressions
Classes can also be defined as expressions, named or anonymous, just like functions:
Static blocks
Static initialization blocks let you run setup logic once, when the class itself is defined (not when an instance is created):
Private fields and methods
Fields/methods prefixed with # are only accessible from inside the class body not from outside, and not even from subclasses:
Classes are just prototypes
Class methods actually live on ClassName.prototype. The class keyword is mostly sugar over this older, more verbose pattern it just makes it more readable and adds features (private fields, static blocks) that were awkward to express before: