Number to currency format and currency to number for calculation. (Thanks to stackoverflow)
function currencyToNumber(currency) {
return Number(currency.replace(/[^0-9\.]+/g,""));
}
function numberToCurrency(number) {
return "$" + number.toFixed(2).replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,")
}