- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Static Members
JavaScript Classes
JavaScript Static Members
Static members belong to the class itself rather than to any instance.
You call them on the class name, not on an object built from it.
Math.max and Array.from are static methods you already use.
Example
Example
javascript
class MathHelper {
static double(n) {
return n * 2;
}
}
console.log(MathHelper.double(5));No instance was created; the method belongs to the class.
