Typescript. Static methods and fields

Here is the same idea as in C#, Java and other langs. Static methods are methods that more devoted to class rather than to instance of class.

class Man {

 private static planet = 'Earth';
 static getPlanet(){return this.planet}

}

console.log(Man.getPlanet());

This entry was posted in Без рубрики. Bookmark the permalink.