JavaScript math ceil() method

The JavaScript math ceil() method is used to get the smallest integer value, either greater than or equal to a number.
Syntax:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Math.ceil(n)
Math.ceil(n)
Math.ceil(n)

Parameters
n: It represents the number.

Returns
The smallest integer value which will be greater than or equal to the specified number.

Example:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<!DOCTYPE html>
<html>
<body>
<script>
document.writeln(Math.abs(-345));
</script>
</body>
</html>
<!DOCTYPE html> <html> <body> <script> document.writeln(Math.abs(-345)); </script> </body> </html>
<!DOCTYPE html>
<html>
<body>
<script>
document.writeln(Math.abs(-345));
</script>
</body>
</html>