jskatas.org Continuously Learn JavaScript. Your Way.

Class: static

Use of the static keyword inside a class.

Donate to NGO Julenka. Support Ukranians in need. Julenka is an NGO which my brother founded in 2011 to support Ukranian families and kids in need.

Inside a class you can use the static keyword

for methods

  • a static method just has the prefix static
  • the method name can be dynamic/computed at runtime

for accessors

  • a getter name can be static, just prefix it with static
  • even a static getter name can be dynamic/computed at runtime