๐Ÿ”ธstatic member

๐Ÿšง under construction

JS โŸฉ value โŸฉ object โŸฉ class โŸฉ member โŸฉ static

๐Ÿšง

In the context of classes, MDN Web Docs content uses the terms properties and fields interchangeably.

โญ๏ธ static members

class A {
  static a;                 // A.a = undefined
  static b = 0;             // A.b   (static property: initialized)
  static get c() { ... }    // A.c   (static getter)
  static d() { ... }        // A.d() (static method)
}

โญ๏ธ private static members

  • accessable only within the class body.

  • private members are not inherited.

class A {
  // โญ๏ธ "#" means "private"
  static #e;                // A.#e    (private static property: uninitialized)
  static get #f() { ... }   // A.#f    (private static getter)
  static #g() { ... }       // A.#g()  (private static method)
}

Last updated