I can’t have both of them at the same time, please help.
First Attempt only Shows Decimal Places
num.toFixed(2).toLocaleString();
Second Attempt doesn’t show anything
var total = sum.toLocalString();
document.getElementById("bro123").value = total.toFixed(2);
2
Answers
You need to change the code like this
toFixed doesn’t work for string.
Here is a an abstract function that contains the logic you described above, if i understood correctly.
This functions accepts both number & string as parameter, and then always convert it to float with 2 decimal points and in the end to string.