Converting a salary input string to number
Posted: 03 Nov 2020, 06:08
I have the following problem:
1. eliminate thousand separators(,) 5,555 to 5555.
2. if the user inputs 55,66 replace , with . and get the value 55.66
3. if user inputs both , and . eg. 1,234.55 gets the value 1234.55
How can I solve it in JavaScript.
1. eliminate thousand separators(,) 5,555 to 5555.
2. if the user inputs 55,66 replace , with . and get the value 55.66
3. if user inputs both , and . eg. 1,234.55 gets the value 1234.55
How can I solve it in JavaScript.