var x = 9.656; var res1 = x.toPrecision(); // 9.656 var res2 = x.toPrecision(2); // 9.7 var res3 = x.toPrecision(4); // 9.656 var res4 = x.toPrecision(6); // 9.65600 //출력 document.write(res1 + "<br>"); document.write(res2 + "<br>"); document.write(res3 + "<br>"); document.write(res4 + "<br>");