Learning Ionic(Second Edition)
上QQ阅读APP看书,第一时间看更新

Defining types

When we declare variables, we can optionally declare the types of variables. For instance:

name: string = 'Arvind'; 
age: number = 99;
isAlive: boolean = true;
hobbies: string[];
anyType: any;
noType = 50;
noType = 'Random String';

This increases the predictability of what we are trying to do.