Skip to content

Function: toFixed()

ts
function toFixed(value, decimals): string;

Format as fixed-point string without scientific notation. 格式化为定点数字符串,不使用科学计数法。

Parameters

ParameterTypeDescription
valuenumberNumber to format / 待格式化的数
decimalsnumberDecimal places / 小数位数

Returns

string

Fixed-point string / 定点数字符串

Example

ts
toFixed(0.000001, 8) // => '0.00000100'

Since

1.0.0

Released under the MIT License.