Skip to content
Wepress
Main Navigation
Home
Examples
基础
HTML
CSS
JavaScript
编程
前端安全
场景题
工程化
性能优化
编程题
跨端技术
框架
Node
React
TypeScript
Vue
小程序
计算机网络
其他
AI相关
leetcode
工具
算法
计算机基础
趣味题
选择题
Appearance
Menu
Return to top
On this page
toPrecision 和 toFixed 和 Math.round 有什么区别?
参考答案:
toPrecision 用于处理精度,精度是从左至右第一个不为 0 的数开始数起。
toFixed 是对小数点后指定位数取整,从小数点开始数起。
Math.round 是将一个数字四舍五入到一个整数。