Javascript Math.ceil()方法
作者:--
发布时间:2019-11-20
评论:0
阅读:0
此方法返回比的最小整数大于或等于给定的参数。
语法
math.ceil( x ) ;
下面是参数的详细信息:
返回值:
返回比的最小整数大于或等于给定的参数(x)。
例子:
<html>
<head>
<title>javascript math ceil() method</title>
</head>
<body>
<script type="text/javascript">
var value = math.ceil(45.95);
document.write("first test value : " + value );
var value = math.ceil(45.20);
document.write("<br />second test value : " + value );
var value = math.ceil(-45.95);
document.write("<br />third test value : " + value );
var value = math.ceil(-45.20);
document.write("<br />fourth test value : " + value );
</script>
</body>
</html>
这将产生以下结果:
first test value : 46
second test value : 46
third test value : -45
fourth test value : -45