Create Class File
Create new Javascript file named index.js. This file contains code demo as below:
class Math {
static square(a) {
return a * a;
}
static cube(a) {
return a * a * a;
}
}
console.log('square: ' + Math.square(2));
console.log('cube: ' + Math.cube(3));
Output
Use node index.js statement run code demo
square: 4
cube: 27