BigInt.prototype.valueOf() - JavaScript | MDN
Try it
console.log(typeof Object(1n));
// Expected output: "object"
console.log(typeof Object(1n).valueOf());
// Expected output: "bigint"
Syntax
Parameters
None.
Return value
A BigInt representing the primitive value of the specified BigInt object.
Examples
Using valueOf
js
typeof Object(1n); // object
typeof Object(1n).valueOf(); // bigint
Specifications
| Specification |
|---|
| ECMAScript® 2026 Language Specification # sec-bigint.prototype.valueof |