Share via


toFixed 方法

更新:2007 年 11 月

傳回表示定點標記數字的字串。

 function toFixed( [fractionDigits : Number] ) : String

引數

  • fractionDigits
    選擇項。小數點後的位數。必須在 0 – 20 (含) 範圍之內。

備註

toFixed 方法會以字串方式傳回採用定點標記的數字。字串包含有效小數點的前一位數,後面必須跟著 fractionDigits 位數。

如果 fractionDigits 未提供或是未定義的話,toFixed 方法會假設數值是零。

需求

5.5 版

套用至:

Number 物件

請參閱

參考

toExponential 方法

toPrecision 方法