I'm using toLocaleString()
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString to convert into a dollar string format, but I'm having trouble reversing the operation. In my case converting back into cents.
dollarString.split('$')[1] * 100
Messes up as soon as the string has a ,
in it.
Is there a better way to handle this, than to go through strings removing commas?
What if I end up using other currencies. Can't I convert in and out of whatever the currency is into a cents representation so I can do math, and then back into some locale?