static class variable example - count how many time method is being invoked
suggest changehere countInstance is a static class variable
class StaticTest{
static countInstance : number= 0;
constructor(){
StaticTest.countInstance++;
}
}
new StaticTest();
new StaticTest();
console.log(StaticTest.countInstance);
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents