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

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.