← Back to Roadmap

Static Methods & Properties

Medium

In plain terms

Static methods belong to the class, not instances. Call with ClassName.method(). Use for utilities, factories, or class-level data. static keyword in class body.

What you need to know

  • static method()
  • Called on class, not instance
  • Static properties ES2022

Try it yourself

Copy the code below and run it in your browser console or a code editor:

class MathUtils {
  static add(a, b) { return a + b; }
  static PI = 3.14;
}
MathUtils.add(1, 2);  // 3
MathUtils.PI;         // 3.14

Learn more

Dive deeper with these trusted resources: