How To Convert Price String To Numeric By Javascript / jQuery

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,""));
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments