Round 数字
填空题 简单
题目
Fill in 空白到 round 3.7 到 nearest integer.
代码
const result = Math.___(3.7);
console.log(result); // 4
提示
方法 rounds 到 nearest integer (上 or 下).
解释
Math.round() rounds 到 nearest integer: 3.7 rounds 上到 4, 3.3 rounds 下到 3, and 3.5 rounds 上到 4 (rounds half 上). Math.floor() 总是 rounds 下, and Math.ceil() 总是 rounds 上.
相关资源
相关课程
- 数字 and Math
学习关于数字 and math 操作.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。