Skip to content
Related Articles

Related Articles

JavaScript | BigInt.prototype.valueOf() Method

View Discussion
Improve Article
Save Article
  • Last Updated : 08 Oct, 2021
View Discussion
Improve Article
Save Article

The BigInt.prototype.toString() method is an inbuilt method in JavaScript which is used to return the wrapped primitive value of a BigInt object.
Syntax: 
 

bigIntObj.valueOf()

Parameters: This method does not accept any parameter.
Return value: This method returns a BigInt representing the primitive value of the specified BigInt object.
Below examples illustrate the BigInt.prototype.toString() method in JavaScript:
Example 1: 
 

javascript




console.log(typeof Object(1324n));
console.log(typeof Object(24324).valueOf());

Output: 
 

"object"
"number"

Example 2: 
 

javascript




console.log(typeof Object("GeeksforGeeks"));
console.log(typeof Object("GeeksforGeeks").valueOf());

Output: 
 

"object"
"string"

Supported Browsers: The browsers supported by BigInt.prototype.valueOf() method are listed below: 
 

  • Google Chrome 67 and above
  • Edge 79 and above
  • Firefox 68 and above
  • Opera 54 and above
  • Safari 14 and above

 

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!