You can use the replace with a regex that takes only the numbers and comma.
It is also necessary to exclude all points from the number before
replace the comma, because if the number has a thousand separator,
will give problem (ex. R$10.000,00
will stay 10.000.00
).
valor = parseFloat(("R$10.000,55").replace(/[^\d,]/g, "").replace(',','.'));
In your case, I would:
valor = parseFloat((colunas[i].textContent).replace(/[^\d,]/g, "").replace(',','.'));
Example:
valor = parseFloat(("R$10.000,55").replace(/[^\d,]/g, "").replace(',','.'));
console.log((valor+10.99).toFixed(2));
Can you use the
String.replace
, ex:(colunas[i].textContent).replace('R$', '').replace(',', '.')
. See more in MDN - String.prototype.replace– Douglas Garrido
Excellent friend!
– Lucas Fonseca