JavaScript BigInt valueOf()
Example
let x = 123456789123456789n;
let y = x.valueOf();
let text = typeof y + ": " + y;
Try it Yourself »
let y = x.valueOf();
let text = typeof y + ": " + y;
Description
The valueOf() method returns the primitive value of a bigint.
The valueOf() method does not change the original bigint.
See Also:
Note
The valueOf() is used internally by JavaScript.
Normally, you will not use it in your code.
Syntax
bigint.valueOf()
Parameters
NONE
Return Value
Type
Description
A BigInt The primitive value of the bigint.
Browser Support
valueOf() is an ECMAScript1 (JavaScript 1997) feature.
It is supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera |