Math.ceil()
14th January 2021
0 Comments
Programming Language
JavaScript [Version: ECMAScript (ECMA-262)]
Syntax
Typical Usage
Rounds a number up to the next largest integer.
Accepted Parameters
- value (integer) (Required): The float value you wish to round up.
Return Value(s)
The number rounded up.Notes
Math.ceil(null) returns integer 0 without a NaN error.
Examples of Math.ceil()
Example 1
console.log(Math.ceil(2.1234))
// Output = 3
The above output will be 3.
Example 2
console.log(Math.ceil(68.7654))
// Output = 69
The above output will be 69.
Similar Functions in Other Languages
- PHP: ceil()
Was This Helpful?
If this post has helped you, please let me know. Your feedback will be highly appreciated and will help me build better content.