长风在西瓜糖里
Blog
Books
Garden
toFixed
2023-07-12
保留小数位数, 同时把数据改成字符串类型
1
var
num
=
3.1415926
2
console
.
log
(num
.
toFixed
(
2
))
// '3.14'
#
javascript
#
number
#
method
#
四舍五入