@IvanFdez01
Posted
About the input tags formatting. It's a delicate job what you've done, but maybe more simplicity would make the code more legible. I develop:
x = yourinput.value; // comes as a string, e.g. "300,000"
x = x.replace(/,/g, ''); // replaces all (g of global) commas for blank spaces, e.g. "300000"
x = parseFloat(x); // tries to convert to float
if (isNaN(x)) {
dont allow calculate
} else // is number
allow calculate
A method like that, of course applied to all inputs before you can press the calculate-button, would be more efficient in my opinion. Finally, I did apply the mentioned method in the calc-button.listener, if you need to check.
Great job even so, nice CSS. Cheers @CardboardPL.
Marked as helpful