24
Format a number to any currency using Javascript
This article will explain you how to convert a number to any currency like - INR, USD, EUR etc using the Javascript international number format API- Intl.NumberFormat.
var number = 3500;
If you don't specify any locales, it will return the formatted number based on your location.
I am from India , so it returned the Indian formatted number.
You can specify location to format number according to it.
To convert number to currency you need to mention the style and the currency format-
- style= currency
- currency= USD, INR, EUR etc
Using this Intl.NumberFormat you can also format other number like- km/hr, litres, etc,
If you liked this content you can support me by following me on twitter and Instagram for more such contents-
24