javascript ceil() 获取小数的整数(取整)

WBOY
Release: 2016-06-01 09:54:40
Original
1551 people have browsed it

ceil() 返回大于等于其数字参数的最小整数。

基本语法:

Math.ceil(number)
Copy after login

必选项number 参数是数值表达式。如何传入一个非数值,则返回NaN。

返回值

大于等于 x,并且与它最接近的整数。

说明

ceil() 方法执行的是向上取整计算,它返回的是大于或等于函数参数,并且与之最接近的整数。

实例:

Copy after login

在线运行

运行结果:

1 1 5 6 -5 NaN
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!