toPrecision() function formats a number with specified digits.
alert(Math.PI); //3.141592653589793 Math.PI.toPrecision(5); //3.14159
toPrecision()function is different from toFixed(), as the precision digits include digits at the left of the point.
alert(Math.PI); //3.141592653589793 Math.PI.toFixed(5); //3.1415
var nm = 436.32943; alert(nm.toPrecision(5)); //436.33