字面量
5.1 number (正数型、浮点型、正负数)
正整数
let age:number = 18
浮点数
let fraction: number = 99.9
正负数
5.2 string (字符串)
let str:string = '枸杞'
5.3 boolean (布尔值)
let b1: boolean = true;
let b2: boolean = false;
4.4 undefine
声明变量但未赋值
例子:let str: undefine;
4.5 null
声明变量,赋值 = null
例子: let str: null = null;
网友评论