Created
May 8, 2021 12:39
-
-
Save zet777/f0c2e358af66b7d9055d6af15467c202 to your computer and use it in GitHub Desktop.
Object Intl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const numberFormat = new Intl.NumberFormat('de-DE'); | |
let out = numberFormat.format(74391351.243); | |
console.log(out); | |
out = new Intl.NumberFormat("en-US",{ | |
style:"percent" | |
}).format(0.25); | |
console.log(out) | |
// Валюты | |
const c = 69900.60; | |
out = new Intl.NumberFormat('ru-RU',{ | |
style: "currency", | |
currency: 'RUB' | |
}).format(c); | |
console.log(out); | |
// Единицы измерения | |
out = new Intl.NumberFormat("en-US",{ | |
style: "unit", | |
unit: 'kilometer-per-hour' | |
}).format(35); | |
console.log(out); | |
out = new Intl.NumberFormat("ru-RU",{ | |
style: "unit", | |
unit: 'liter', | |
unitDisplay: 'long'// полное название единицы измерения с поддержкой падежей | |
}).format(3); | |
console.log(out); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment