Predict Integer Division
预测输出 简单
题目
什么做 这个 code print?
代码
console.log(7 / 2);
console.log(Math.floor(7 / 2));
提示
JavaScript division 总是返回 float; Math.floor rounds 下.
解释
In JavaScript, 7 / 2 = 3.5 (JavaScript 有仅 one 数字类型, 总是 floating 点). Math.floor(3.5) rounds 下到 3. 输出是: 3.5 (首先行) and 3 (其次行). In Python, 7 / 2 = 3.5 and 7 // 2 = 3.
相关资源
相关课程
- 数字 and Math
学习关于数字 and math 操作.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。