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.

Basic Usage-

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.

Format number using locales-

You can specify location to format number according to it.

Format number to any currency using locale-

To convert number to currency you need to mention the style and the currency format-

  1. style= currency
  2. currency= USD, INR, EUR etc
For Indian currency-
For US dollar currency-

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