尝试一下
console.log(typeof Object(1n));
// Expected output: "object"
console.log(typeof Object(1n).valueOf());
// Expected output: "bigint"
语法
bigIntObj.valueOf()
返回值
表示指定 BigInt 对象的原始 BigInt 值。
示例
>Using valueOf
js
typeof Object(1n); // object
typeof Object(1n).valueOf(); // bigint
规范
| 规范 |
|---|
| ECMAScript® 2027 Language Specification> # sec-bigint.prototype.valueof> |