Understanding static Methods in Classes in Javascript


Static methods are called on the class itself, not on instances of the class.

Source Code

class Utility {
  static multiply(x, y) {
    return x * y;
  }
}
console.log(Utility.multiply(5, 10)); // 50
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments