1const formatToCurrency = amount => {
2 return "$" + amount.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, "$&,");
3};
4formatToCurrency(12.34546); //"$12.35"
5formatToCurrency(42345255.356); //"$42,345,255.36
1function formatToCurrency(amount){
2 return (amount).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
3}
4formatToCurrency(12.34546); //"12.35"
5formatToCurrency(42345255.356); //"42,345,255.36"
1function floatToEuro(float){
2 var euroCurrency
3 euroCurrency = '\u20AC' + float.toLocaleString('nl-NL',{minimumFractionDigits: 2});
4 console.log(euroCurrency);
5 return euroCurrency;
6};