Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert float number properly?

Tags:

javascript

How can I convert this string to get 1000000? The problem is I always get 10000:

console.log(parseFloat('10.000.000,00'.replace('.', ',').replace(/,(?=[^,]*$)/, '.')),'test');

Any suggestions?

like image 540
None Avatar asked Oct 15 '22 10:10

None


1 Answers

parseFloat(a.replace(/\./g, '').replace(',', '.'))
like image 77
f278f1b2 Avatar answered Oct 19 '22 22:10

f278f1b2