How to round up a number in JavaScript

1 Answer

0 votes
console.log(Math.ceil(4.99)); 
console.log(Math.ceil(4.0009)); 
console.log(Math.ceil(4.1)); 
console.log(Math.ceil(-5.009)); 
console.log(Math.ceil(-5.99)); 
console.log(Math.ceil(-5.1)); 
 
   
    
    
/*
    
run:
    
5
5
5
-5
-5
-5
    
*/

 



answered Jun 8, 2022 by avibootz
edited Jun 8, 2022 by avibootz

Related questions

1 answer 158 views
1 answer 157 views
1 answer 141 views
1 answer 120 views
2 answers 305 views
...