I am learning Angular4 and going through the tutorial examples.
https://angular.io/docs/ts/latest/tutorial/toh-pt1.html
I have the below code in the tutoria
Because it's Typescript, not JavaScript. Typescript have that style of variable data type definition. That's the big advantage in TypeScript: Full oop and typesafe variables.