I have an array containing strings with prices and sometimes surrounded by characters.
How do I transform it from?
[0] > '$9.99/aa'
[1] > '$2.99'
[2] > '$1.'
to:
[0] > '9.99'
[1] > '2.99'
[2] > '1'
So I can do comparisons with the values? I just need to know how to change one and I can apply it to the array easily
strips out all characters that cannot appear in a JavaScript number, and then applies the
+operator to it to convert it to a number. If you don’t have numbers in hex format or exponential format then you can do without theex.EDIT:
To handle locales, and handle numbers in a more tailored way, I would do the following