Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

JavaScript v. 1.5 changes to rounding function question?

How has the 1.5 version of JavaScript made rounding for currency applications easier? Please see code below:

subtax contains the value of lets say 4.5678
// Old method of Java
//window.document.form1.tot1.value = "$ " + (Math.round(subtax*100)/100);
// New method of JavaScript 1.5
window.document.form1.tot1.value = "$ " + (subtax.toFixed(2));

Would the function toFixed (num of digits to round to) be my answer?
Thanks,
Janis
Sign In or Register to comment.