Number.toPrecision
指定された桁数にします。123.4の場合、toPrecision(7)とすると結果は123.4000となります。Macintosh版Internet Explorer 5では動作しません。Windows版Internet Explorerはバージョン5.5以降で利用することができます。
構文
数値.toPrecision(桁数)
例文
<html> <head> <title>Number.toPrecision</title> </head> <body> <script type="text/javascript"><!-- n = 123.4; val = n.toPrecision(7); document.write(val); // --></script> </body> </html>
関連記事
- Number.toFixed
- Number.toExponential
- Number.prototype
- Number.NaN
- isNaN
- Number.toString
- Number.POSITIVE_INFINITY
- Number.NEGATIVE_INFINITY
- Number.MIN_VALUE
- Number.MAX_VALUE
スポンサーリンク