19
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.
![](https://res.cloudinary.com/practicaldev/image/fetch/s--mg7n4NkT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fhk5oktku419zsbed8xz.png)
I am from India , so it returned the Indian formatted number.
You can specify location to format number according to it.
![](https://res.cloudinary.com/practicaldev/image/fetch/s--o5vjgPrq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ytnxzds27fb32h9r2fr8.png)
To convert number to currency you need to mention the style and the currency format-
- style= currency
- currency= USD, INR, EUR etc
![](https://res.cloudinary.com/practicaldev/image/fetch/s--pcYsgASL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9uw5yae0hfmrpe4gsj3q.png)
![](https://res.cloudinary.com/practicaldev/image/fetch/s--1XK_0lwu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p8fagby23tx3ddfu0y0u.png)
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-
19