Baseline Widely available *
Intl.NumberFormat
ì ì¸ì´ì ë§ë ì«ì ììì ì§ìíë ê°ì²´ì ìì±ìì
ëë¤.
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"
ìì±ì
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()
Array
를 ë°íí©ëë¤.Intl.NumberFormat.prototype.formatToParts()
Array
를 ë°íí©ëë¤.Intl.NumberFormat.prototype.resolvedOptions()
ë¡ì¼ì¼ì ì§ì íì§ ìê³ ì¬ì©íë©´ 기본 ë¡ì¼ì¼ ë° ê¸°ë³¸ ìµì ììì ì ì©í 문ìì´ì ë°íí©ëë¤.
const number = 3500;
console.log(new Intl.NumberFormat().format(number));
// â íêµ ë¡ì¼ì¼ì ê²½ì° '3,500' íì
locales
ì¬ì©í기
ë¤ì ìì ë ì§ìíë ì«ì ììì ìì를 ë³´ì
ëë¤. ì´í리ì¼ì´ì
ì ì¬ì©ì ì¸í°íì´ì¤ ì¸ì´ì ë§ë ììì ì ì©íë ¤ë©´ locales
매ê°ë³ìë¡ ì ì í ì¸ì´(ì, íìí ê²½ì° ëì²´ ì¸ì´)를 ì ê³µíë걸 ìì§ ë§ì¸ì.
const number = 123456.789;
// ë
ì¼ì ììì 구ë¶ìë¡ ì¼í를 ì¬ì©íê³ ì² ë¨ì 구ë¶ìë¡ ë§ì¹¨í를 ì¬ì©
console.log(new Intl.NumberFormat("de-DE").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
매ê°ë³ì를 ì§ì í´ ê²°ê³¼ë¥¼ ìíë ííë¡ ë°ê¿ ì ììµëë¤.
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("ko-KR", { style: "currency", currency: "KRW" }).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
ëª
ì¸ ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4