Convert the number into Currency and weight

In this article, we are going to learn about how we can convert the numbe into currency or weight with proper format.

For Example:- You are showing the currency data into table and the currency showing as normal number. So, This article goona help you a lot.

For Currency:-
var  amount= 794524.6843;
const formatter = new Intl.NumberFormat('en-US', {
            style: 'currency',
            currency: 'USD',
            minimumFractionDigits: 2
        })
formatter.format(amount);//Output = $794,524.68
var  amount= 794524.6843;
const formatter = new Intl.NumberFormat('ja-JP', {
            style: 'currency',
            currency: 'JPY',
            minimumFractionDigits: 2
        })
formatter.format(amount);//Output = ¥794,524.68
var  amount= 794524.6843;
const formatter = new Intl.NumberFormat('de-DE', {
            style: 'currency',
            currency: 'EUR',
            minimumFractionDigits: 2
        })
formatter.format(amount);//Output = 794.524,68 €
For Weight:-
var weight= 30;
const formatter = new Intl.NumberFormat('pt-PT', {
style: 'unit',
currency: 'kilometer-per-hour',
minimumFractionDigits: 2
})
formatter.format(amount);//Output = 30 km/h

HAPPY LEARNING