Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[js] 第350天 Math.ceil()、Math.round()、Math.floor()三者的区别是什么? #2165

Open
haizhilin2013 opened this issue Mar 30, 2020 · 2 comments
Labels
js JavaScript

Comments

@haizhilin2013
Copy link
Collaborator

第350天 Math.ceil()、Math.round()、Math.floor()三者的区别是什么?

我也要出题

@haizhilin2013 haizhilin2013 added the js JavaScript label Mar 30, 2020
@carrieBlock
Copy link

上取整 四舍五入 下取整

@amyhuangxbd
Copy link

Math.ceil() 函数返回大于或等于一个给定数字的最小整数。
`console.log(Math.ceil(.95));
// expected output: 1

console.log(Math.ceil(4));
// expected output: 4

console.log(Math.ceil(7.004));
// expected output: 8

console.log(Math.ceil(-7.004));
// expected output: -7
`
Math.round() 函数返回一个数字四舍五入后最接近的整数。

Math.floor() 返回小于或等于一个给定数字的最大整数。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
js JavaScript
Projects
None yet
Development

No branches or pull requests

3 participants