Tutorial by Examples

A generic Car class has some car property and a description method class Car{ name:string; engineCapacity:string; constructor(name:string,engineCapacity:string){ this.name = name; this.engineCapacity = engineCapacity; } describeCar(){ console....
here countInstance is a static class variable class StaticTest{ static countInstance : number= 0; constructor(){ StaticTest.countInstance++; } } new StaticTest(); new StaticTest(); console.log(StaticTest.countInstance);

Page 1 of 1