test('subclass overrides static description',SquaredTriple.description,"I square the triple of any number you provide");
console.log('\n=== Static with this reference ===');
classStaticMethodCall{
staticstaticProperty="static property";
staticstaticMethod(){
return"Static method and "+this.staticProperty+" has been called";
}
staticanotherStaticMethod(){
returnthis.staticMethod()+" from another static method";
}
}
test('static method using this.staticProperty',StaticMethodCall.staticMethod(),"Static method and static property has been called");
test('static method calling another static method',StaticMethodCall.anotherStaticMethod(),"Static method and static property has been called from another static method");
console.log('\n=== Static Field Without Initializer ===');
classClassWithUndefinedStatic{
staticundefinedField;
staticdefinedField="defined";
}
test('static field without initializer',ClassWithUndefinedStatic.undefinedField,undefined);
test('static field with initializer',ClassWithUndefinedStatic.definedField,"defined");
console.log('\n=== Static with Computed Values ===');
classMathHelper{
staticPI=3.14159;
staticTWO_PI=3.14159*2;
staticcircleArea(r){
returnthis.PI*r*r;
}
}
test('static computed value TWO_PI',MathHelper.TWO_PI,3.14159*2);
test('static method using static property',MathHelper.circleArea(1),3.14159);