320
How can I extract a number from a string in JavaScript?
In this blog post you will learn how to extract numbers from a string. Using following code snippet will extracts prices with currency and formatting:
var price = "£1,739.12"; parseFloat(price.replace( /[^\d\.]*/g, '')); Output would be as below // 1739.12