Skip to content

Instantly share code, notes, and snippets.

@ashour
Last active March 12, 2020 17:02
Show Gist options
  • Select an option

  • Save ashour/44799fd3bc54817d382d169e12f8b7eb to your computer and use it in GitHub Desktop.

Select an option

Save ashour/44799fd3bc54817d382d169e12f8b7eb to your computer and use it in GitHub Desktop.
const number = 123456.78;
const usFormatter = new Intl.NumberFormat("en-US");
console.log(usFormatter.format(number)); // => 123,456.78 (American format)
const frenchFormatter = new Intl.NumberFormat("fr-FR");
console.log(frenchFormatter.format(number)); // => 123 456,78 (French format)
const arabicFormatter = new Intl.NumberFormat("ar-AR");
console.log(arabicFormatter.format(number)); // => ١٢٣٬٤٥٦٫٧٨ (Arabic format)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment