
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
Display the result difference while using ceil() in JavaScript?
The Math.ceil() is part of the Math object in JavaScript. Suppose, your value is 4.5 or 4.3, it will give the result 5.
Let’s say the following are our values −
var result1 = 98; var result2 = 5;
Following is the code to display the result difference while using ceil() or not −
var result1 = 98; var result2 = 5; console.log("The actual result is=" + result1 / result2); var output = Math.ceil(result1 / result2); console.log("The ceil result is=" + output);
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo229.js.
Output
The output is as follows −
PS C:\Users\Amit\JavaScript-code> node demo229.js The actual result is=19.6 The ceil result is=20
- Related Articles
- JavaScript display the result of a function as HTML?
- Using JSON.stringify() to display spread operator result?
- Find ceil of a/b without using ceil() function in C++.
- Return the ceil of the array elements and store the result in a new location in Numpy
- Display a message on console while focusing on input type in JavaScript?
- Check whether Enter key is pressed or not and display the result in console with JavaScript?
- Add two consecutive elements from the original array and display the result in a new array with JavaScript
- The while loop in Javascript
- Query to divide the values of two columns and display the result in a new column using MySQL wildcard?
- Find floor and ceil in an unsorted array using C++.
- The do…while loop in Javascript
- How can I display MySQL query result vertically?
- While using the ROLLUP modifier, is it possible to use a MySQL ORDER BY clause to sort the result?
- ceil() function in PHP
- What are the best practices to be followed while using JavaScript?

Advertisements