How can I convert a price string with currency symbol to a int or double number. e.g $7,000.9 -> 7000.9
We can use RegExp to remove non digits or dots
var currency = "$7,000.90"; var number = Number(currency.replace(/[^0-9\.]+/g,""));
How can I convert a price string with currency symbol to a int or double number. e.g $7,000.9 -> 7000.9
We can use RegExp to remove non digits or dots
var currency = "$7,000.90"; var number = Number(currency.replace(/[^0-9\.]+/g,""));