javascript instance method
BigInt.prototype.valueOf()
The valueOf() method of BigInt values returns the wrapped primitive value
of a BigInt object.
Interactive exampleOpen the canonical MDN source to run this embedded demo.
console.log(typeof Object(1n));
// Expected output: "object"
console.log(typeof Object(1n).valueOf());
// Expected output: "bigint"
Syntax
valueOf()
Parameters
None.
Return value
A BigInt representing the primitive value of the specified BigInt object.
Examples
Using valueOf
typeof Object(1n); // object
typeof Object(1n).valueOf(); // bigint
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.