Sunday, September 25, 2016

javascript - JS round to 2 decimal places

I am trying to limit the returned number to be only 2 decimal places but this code isn't working for me;



function myFunction() {
var x = document.getElementById("mySelect").value;
document.getElementById("demo").innerHTML = "Result is: " + x * 1.09; value = valToRound.toFixed(2);



}



What am I doing wrong?

No comments:

Post a Comment