Advertisement

Class Declaration

class Person {
  constructor(name) {
    this.name = name;
  }
  greet() {
    return `Hello ${this.name}`;
  }
}

Inheritance

class Student extends Person {
  constructor(name, grade) {
    super(name);
    this.grade = grade;
  }
}

Static Methods

class Utils {
  static add(a, b) {
    return a + b;
  }
}
Advertisement
Last updated: January 2026
Advertisement