Convert number to local currencies using javascript
The toLocaleString() returns a number as a string, using local language format.
The language format depends on the locale setup on your computer.
Syntax
number.toLocaleString(locales, options)
const a = 232332323
Format a number into a currency string, using the locale specific of USA:
a.toLocaleString('en-US',{style:'currency', currency:'USD'})
output: '$232,332,323.00'
Format a number into a currency string, using the locale specific of INR:
b.toLocaleString('en-IN',{style:'currency', currency:'INR'})
output: '$232,332,323.00'
Top comments (0)