How can I add a condition in the following function --> When the currency is not USD don't add the $ sign in the front of the amount.
var convertToCurrency = number => {
if (!number) return '';
return new Intl.NumberFormat('en', {
style: 'currency',
currency: 'USD'
}).format(number);
};
var amount = {
amount: 10,
currency: "JPY"
};
convertToCurrency(amount["amount"]);
==> $10.00 JPY