[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat [Back]  [Original]

Intl.NumberFormat - 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

Intl.NumberFormat

Baseline Widely available

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

Intl.NumberFormat .

In this article

const number = 123456.789;

console.log(
  new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(
    number,
  ),
);
// Expected output: "123.456,79 "

// The Japanese yen doesn't use a minor unit
console.log(
  new Intl.NumberFormat("ja-JP", { style: "currency", currency: "JPY" }).format(
    number,
  ),
);
// Expected output: "123,457"

// Limit to three significant digits
console.log(
  new Intl.NumberFormat("en-IN", { maximumSignificantDigits: 3 }).format(
    number,
  ),
);
// Expected output: "1,23,000"

Constructor

Intl.NumberFormat()

NumberFormat.

Intl.NumberFormat.supportedLocalesOf()

, , .

Intl.NumberFormat.prototype Intl.NumberFormat.

Intl.NumberFormat.prototype.constructor

-, . Intl.NumberFormat Intl.NumberFormat.

Intl.NumberFormat.prototype[@@toStringTag]

@@toStringTag "Intl.NumberFormat". Object.prototype.toString().

Intl.NumberFormat.prototype.format()

-, Intl.NumberFormat.

Intl.NumberFormat.prototype.formatRange()

-, Intl.NumberFormat, .

Intl.NumberFormat.prototype.formatRangeToParts()

, , .

Intl.NumberFormat.prototype.formatToParts()

, , .

Intl.NumberFormat.prototype.resolvedOptions()

, , .

NumberFormat

, .

js
const number = 3500;

console.log(new Intl.NumberFormat().format(number));
// '3,500'   US English

locales

. , , , (, , ) locales:

js
const number = 123456.789;

//           ,      - 
console.log(new Intl.NumberFormat("de-DE").format(number));
// 123.456,789

//           ,      - 
console.log(new Intl.NumberFormat("ru-RU").format(number));
// 123 456,789

//        
console.log(new Intl.NumberFormat("ar-EG").format(number));
// 

//      //
console.log(new Intl.NumberFormat("en-IN").format(number));
// 1,23,456.789

//   nu   , ,  
console.log(new Intl.NumberFormat("zh-Hans-CN-u-nu-hanidec").format(number));
// ,.

//      , 
// ,    ,    
console.log(new Intl.NumberFormat(["ban", "id"]).format(number));
// 123.456,789

options

options:

js
const number = 123456.789;

//   
console.log(
  new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(
    number,
  ),
);
// 123.456,79 

console.log(
  new Intl.NumberFormat("ru-RU", { style: "currency", currency: "RUB" }).format(
    number,
  ),
);
// 123 456,79 .

//      
console.log(
  new Intl.NumberFormat("ja-JP", { style: "currency", currency: "JPY" }).format(
    number,
  ),
);
// 123,457

//     
console.log(
  new Intl.NumberFormat("en-IN", { maximumSignificantDigits: 3 }).format(
    number,
  ),
);
// 1,23,000

//    
console.log(
  new Intl.NumberFormat("pt-PT", {
    style: "unit",
    unit: "kilometer-per-hour",
  }).format(50),
);
// 50 km/h

console.log(
  (16).toLocaleString("en-GB", {
    style: "unit",
    unit: "liter",
    unitDisplay: "long",
  }),
);
// 16 litres

Intl.NumberFormat() constructor.

Specification
ECMAScript 2027 Internationalization API Specification
# numberformat-objects


Web Proxy Viewer  |  New URL  |  Original Page