Ceil() and Floor() math functions in Javascript
Ceil() and Floor() math functions in Javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Test Page</title>
</head>
<body>
<script type="text/javascript">
var a = 0.8;
var b = 10.11;
var c = -10.11;
var d = 10.5;
var x = Math.ceil(a);
var y = Math.ceil(b);
var z = Math.ceil(c);
var q = Math.ceil(d);
var xx = Math.floor(a);
var yy = Math.floor(b);
var zz = Math.floor(c);
var qq = Math.floor(d);
console.log(x);
console.log(y);
console.log(z);
console.log(q);
console.log(xx);
console.log(yy);
console.log(zz);
console.log(qq);
</script>
</body>
</html>
Comments
Post a Comment
I WOULD APPRECIATE IF YOU LEAVE A COMMENT OR YOUR FEEDBACK HERE !!!