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

Introduction to using JavaScript Math.ceil() function_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 17:09:551673browse

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

Statement:
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