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

BigInt.prototype.toLocaleString() - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

BigInt.prototype.toLocaleString()

Baseline

20209

toLocaleString() BigInt Intl.NumberFormat API Intl.NumberFormat

toLocaleString Intl.NumberFormat format() NumberFormat format

const bigint = 123456789123456789n;

// 
console.log(bigint.toLocaleString("de-DE"));
// : "123.456.789.123.456.789"

// 
console.log(
  bigint.toLocaleString("de-DE", { style: "currency", currency: "EUR" }),
);
// : "123.456.789.123.456.789,00 "

js
toLocaleString()
toLocaleString(locales)
toLocaleString(locales, options)

locales options

Intl.NumberFormat API Intl.NumberFormat() Intl.NumberFormat

locales

BCP 47 Intl.NumberFormat() locales

Intl.NumberFormat

options

Intl.NumberFormat() options

Intl.NumberFormat

Intl.NumberFormat()

Intl.NumberFormat new Intl.NumberFormat(locales, options).format(number)

: toLocaleString() toLocaleString()

toLocaleString()

js
const bigint = 3500n;

console.log(bigint.toLocaleString());
// "3,500"  (U.S. English )

locales options

API locales options toLocaleString() locales options Intl API

js
function toLocaleStringSupportsLocales() {
  return (
    typeof Intl === "object" &&
    !!Intl &&
    typeof Intl.NumberFormat === "function"
  );
}

locales

locale ()

js
const bigint = 123456789123456789n;

// 
console.log(bigint.toLocaleString("de-DE"));
// 123.456.789.123.456.789

// 
console.log(bigint.toLocaleString("ar-EG"));
// 

// //
console.log(bigint.toLocaleString("en-IN"));
// 1,23,45,67,89,12,34,56,789

// nu 
console.log(bigint.toLocaleString("zh-Hans-CN-u-nu-hanidec"));
//  ,,,,,

// 
// 
console.log(bigint.toLocaleString(["ban", "id"]));
//  123.456.789.123.456.789

options

toLocaleString() options

js
const bigint = 123456789123456789n;

// 
console.log(
  bigint.toLocaleString("de-DE", { style: "currency", currency: "EUR" }),
);
// 123.456.789.123.456.789,00 

// 
console.log(
  bigint.toLocaleString("ja-JP", { style: "currency", currency: "JPY" }),
);
// 123,456,789,123,456,789

//  3 
console.log(bigint.toLocaleString("en-IN", { maximumSignificantDigits: 3 }));
// 1,23,00,00,00,00,00,00,000

ECMAScript 2027 Internationalization API Specification
# sup-bigint.prototype.tolocalestring


Web Proxy Viewer  |  New URL  |  Original Page