Math.ceil(n) this method is used to return the smaller are larger integer of the given decimal point number . If you give the 5.9 it will convert the number and given the output as 6. You can give both the normal number and also the – value number.
Syntax:
Math.ceil(5.4)
Example:
<script> var one = Math.ceil(6.9); document.writeln('Output of 6.9 is : ' + one + '</br></br>'); var two = Math.ceil(30.4); document.writeln('Output of 30.4 is : ' + two + '</br></br>'); var three = Math.ceil(-40.9); document.writeln('Output of -40.9 is : ' + three + '</br></br>'); var four = Math.ceil(-8.8); document.writeln('Output of -8.8 is : ' + four + '</br></br>'); </script>
Output:
Output of 6.9 is : 7 Output of 30.4 is : 31 Output of -40.9 is : -40 Output of -8.8 is : -8