[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/BigInt/toString [Back]  [Original]

BigInt.prototype.toString() - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

BigInt.prototype.toString()

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2020 9.

BigInt toString() BigInt . "n" .

In this article

console.log(1024n.toString());
// Expected output: "1024"

console.log(1024n.toString(2));
// Expected output: "10000000000"

console.log(1024n.toString(16));
// Expected output: "400"

js
toString()
toString(radix)

radix Optional

BigInt 2 36 . 10.

BigInt

RangeError

radix 2 36

BigInt Object toString . Object.prototype.toString() . BigInt toString() .

10 9 . 16 a f .

BigInt . 2 . - 2 , BigInt 2 .

toString() this BigInt . this BigInt TypeError .

BigInt [@@toPrimitive]() BigInt JavaScript toString() . BigInt toString() , toString() .

js
BigInt.prototype.toString = () => "Overridden";
console.log(`${1n}`); // "1"
console.log(`${Object(1n)}`); // "Overridden"

toString()

js
17n.toString(); // "17"
66n.toString(2); // "1000010"
254n.toString(16); // "fe"
(-10n).toString(2); // "-1010"
(-0xffn).toString(2); // "-11111111"

0 BigInt

0 0 BigInt . 0.0 JavaScript Number IEEE .

js
(-0n).toString(); // "0"
BigInt(-0).toString(); // "0"

Specification
ECMAScript 2027 LanguageSpecification
# sec-bigint.prototype.tostring


Web Proxy Viewer  |  New URL  |  Original Page