Sunday 25 September 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

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...