数据类型
JS 数据类型分为两大类及八种数据类型 ES6新增 bigint
- 7 种原始类型,使用 typeof 运算符检查:
- Object:typeof instance === “object”。任何 constructed 对象实例的特殊非数据结构类型,也用做数据结构:new Object,new Array,new Map,new Set,new WeakMap,new WeakSet,new Date,和几乎所有通过 new keyword 创建的东西。
BigInt类型是 JavaScript 中的一个基础的数值类型,可以用任意精度表示整数。使用 BigInt,您可以安全地存储和操作大整数,甚至可以超过数字的安全整数限制。BigInt 是通过在整数末尾附加 n 或调用构造函数来创建的。
> const x = 2n ** 53n;
9007199254740992n
> const y = x + 1n;
9007199254740993n
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Data_structures