toPrecision

種類メソッド
書式 数値.toPrecision(桁数)
解説
値を指定した桁数にします。
サンプルコード
num = 123.45;
n = num.toPrecision(8);
alert(n);
実際のスクリプトをダウンロード