Bootstrap

【TS笔记】数据类型

基础类型

1.布尔值(Boolean)

   let isDone: Boolean = false;

2.数字(number)

   let num: number = 123;
   let num2: number = 0xf00d; 

3.字符串(string)

   let person: string = "小明";   
   person = '笑笑'

   let person2: string = "小华";
   let age = 20;
   let sentence: string = `Hello,my name is ${person2}. I'll be ${age} years old next month.`;

   let sentence2: string = "Hello,my name is" + person + ".\n\n" + "I'll be" + (age + 1) + "years old next month.";

4.数组(Array)

   let list: number[] = [1, 2, 3];

   let list2:Array<number> = [1, 2, 3];

5.元组(Tuple) (元组类型允许表示一个已知元素数量和类型的数组&

;