AbdulElahGwaith's picture
Upload folder using huggingface_hub
780c9fe verified
metadata
title: BigInt.prototype.valueOf()
short-title: valueOf()
slug: Web/JavaScript/Reference/Global_Objects/BigInt/valueOf
page-type: javascript-instance-method
browser-compat: javascript.builtins.BigInt.valueOf
sidebar: jsref

The valueOf() method of {{jsxref("BigInt")}} values returns the wrapped primitive value of a {{jsxref("BigInt")}} object.

{{InteractiveExample("JavaScript Demo: BigInt.prototype.valueOf()", "shorter")}}

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 {{jsxref("BigInt")}} object.

Examples

Using valueOf

typeof Object(1n); // object
typeof Object(1n).valueOf(); // bigint

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{jsxref("BigInt.prototype.toString()")}}