文章目录
一、 9 种数据类型
最新的 ECMAScript 标准定义了 9 种数据类型:
- 6 种原始类型,使用 typeof 运算符检查:
- undefined:typeof instance === “undefined”
- Boolean:typeof instance === “boolean”
- Number:typeof instance === “number”
- String:typeof instance === "string
- BigInt:typeof instance === “bigint”
- Symbol :typeof instance === “symbol”
var str="string";
console.log(typeof str); //string
var num=1;
console.log(typeof num); //number
var bn=false;
console.log(typeof bn); //boolean
var a;
console.log(typeof a); //undfined
var bigint = BigInt("9007199254740995");
console.log(typeof bigint); //bigint
var syboml = Symbo