Home > Web Front-end > JS Tutorial > Introduction to using JavaScript Math.ceil() function_Basic knowledge

Introduction to using JavaScript Math.ceil() function_Basic knowledge

WBOY
Release: 2016-05-16 17:09:55
Original
1705 people have browsed it

Math.ceil(x) -- Returns the smallest integer (rounding function) that is greater than or equal to the numeric parameter, and rounds the number up

ceil is the abbreviation of ceiling, which means "upper limit" in Chinese

Reference URL: http://www.dreamdu.com/javascript/Math.ceil/

ceil function syntax

Math.ceil(x);

ceil function parameter

x -- a number of type number

ceil function return value

Return the smallest integer greater than or equal to (-5.99));
document.write(Math.ceil(1.01));
document.write(Math.ceil(-1.01)); Result:

6
-5
2
-1

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template