文档指南:
https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/BigInt
TC39——(18年fullstack大会上,Brendan Eich介绍,会在TC39加入BigInt:这是一种新的值类型,用于处理任意精度的整数;)
https://tc39.es/ecma262/#sec-bigint-objects
1 | 21.2.1 The BigInt Constructor |
查看浏览器是否实现了这个API
1 | let target = new Set() |
最大安全数
https://2ality.com/2013/10/safe-integers.html
延伸
String的maxLength
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length
1 | This property returns the number of code units in the string. UTF-16, the string format used by JavaScript, uses a single 16-bit code unit to represent the most common characters, but needs to use two code units for less commonly-used characters, so it's possible for the value returned by length to not match the actual number of characters in the string. |
类型转换
1 | “等值(==)”运算中,不能确定左、右操作数的类型;(JavaScript 认为,如果左、右操作数之一为 string、number、bigint 和 symbol 四种基础类型之一,而另一个操作数是对象类型 (x),那么就需要将对象类型“转换成基础类型(ToPrimitive(x))”来进行比较。操作数将尽量转换为数字来进行比较,即最终结果将等效于:Number(x) == Number(y)。) |
相关
- V8——2018 年,团队为 WebAssembly 发布了一个名为 Liftoff 的基线编译器,它大大减少了 WebAssembly 应用程序的启动时间,同时提供了可预测的性能。并且发布了 BigInt,这是一个新的 JavaScript 原始类型,可以实现任意精度的整数。