对数字保留小数点后几位
- Source:
Example
toFixed(0.3358) => "0.34"
toFixed('0.3358') => "0.34"
Parameters:
Name | Type | Description |
---|---|---|
value |
String | Number | 需要保留小数点的数值 |
num |
Number | 保留小数点后几位 默认 2 位 |
Returns:
保留后的数值字符串
- Type
- String