BigInt.prototype.valueOf()

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 值的 valueOf() 方法返回 BigInt 对象的封装原始值。

¥The valueOf() method of BigInt values returns the wrapped primitive value of a BigInt object.

Try it

语法

¥Syntax

js
valueOf()

参数

¥Parameters

没有任何。

¥None.

返回值

¥Return value

表示指定 BigInt 对象的原始值的 BigInt。

¥A BigInt representing the primitive value of the specified BigInt object.

示例

¥Examples

使用 valueOf

¥Using valueOf

js
typeof Object(1n); // object
typeof Object(1n).valueOf(); // bigint

规范

Specification
ECMAScript Language Specification
# sec-bigint.prototype.valueof

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看