基本数据类型
- Number
- String
- Boolean
- undefined
- Null
- Symbol
- Bigint
其中 6,7为新增属性简单了解即可
Symbol 它的值是唯一的
let symData0 = Symbol('symdata')
let symData1 = Symbol('symdata')
console.log(symData0 === symData1) //false
Bigint 大的整数使用
let max = Number.MAX_SAFE_INTEGER; //最大安全整数
console.log(max); // 9007199254740991
let max0= max + 1; // 9007199254740992
let max1= max + 2; // 9007199254740993
console.log(max0;
console.log(max0=== max1; // true
let maxs = BigInt(Number.MAX_SAFE_INTEGER);
// let maxs0 = maxx + 1; // 会报错
// let maxs0 = maxs + 1n; // 会报错
let maxs0 = maxs + BigInt(1);
let maxs1 = maxs + BigInt(2);
console.log(maxs0);
console.log(maxs0 === maxs1); // false