متد toPrecision()
بازگشت به صفحه اصلی
بازگشت به صفحه مقاله
دو ستونی
دو سطری
اجرای کد RUN »
<!DOCTYPE html> <html> <body> <p>The toPrecision() method returns a string, with a number written with a specified length:</p> <p id="demo"></p> <script> var x = 9.656; document.getElementById("demo").innerHTML = x.toPrecision() + "<br>" + x.toPrecision(2) + "<br>" + x.toPrecision(4) + "<br>" + x.toPrecision(6); </script> </body> </html>