BigInt() constructor

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2020.

BigInt() 构造函数用来创建 BigInt 对象。

语法

js
BigInt(value)

参数

value

被创建的对象的数值。可以是字符串或整数。

备注: BigInt() 不与 new 运算符一起使用。

示例

js
BigInt(123);
// 123n

规范

Specification
ECMAScript Language Specification
# sec-bigint-constructor

浏览器兼容性

BCD tables only load in the browser

参见