Class Syntax (Preview): constructor, methods, static, extends
A gentle look at class syntax: constructor, instance methods, static helpers, and simple inheritance with extends.
Intro to class syntax
Goal: See how class syntax maps to prototypes.
- constructor for setup
- methods on the prototype
- static helpers on the class
- extends for simple inheritance

Constructor + method
The constructor runs on new. Methods in the class body are shared by all instances (prototype).
// Class with a constructor and an instance method
class Counter {
constructor(start = 0) {
// Initialize fields
this.value = start;
}
// Instance method (lives on the prototype)
inc() {
this.value = this.value + 1;
console.log("Now:", this.value);
}
}
const c = new Counter(1);
c.inc();
c.inc();

All lessons in this course
- Prototype Chain & Own-Property Basics
- Class Syntax (Preview): constructor, methods, static, extends