format to currency javascript
function formatToCurrency(amount){
return (amount).toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,');
}
formatToCurrency(12.34546); //"12.35"
formatToCurrency(42345255.356); //"42,345,255.36"const formatToCurrency = amount => {
return "$" + amount.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, "$&,");
};
formatToCurrency(12.34546); //"$12.35"
formatToCurrency(42345255.356); //"$42,345,255.36
Also in JavaScript:
- composer require friendsofcake/crud-json-api for cakephp3 version
- javascript var in quotes
- javascript replace big list
- javascript remove variable from array
- regex only uppercase letters js
- vue js implementation
- minvalue validation react admin
- post antiforgerytoken jquery
- javascript rpg tutorial
- js array clone
- js after settimeout
- ngmodel div angular 7
- express and node
- conditional object spread
- concat array javascript
- add event listener on click
- make angular to run on a different port
- download print.js rtl
- javascript loop through arrya
- ngfor index
- javascript length of number
- servicenow json insert
- class component react
- javascript object to array