How to round down a number in JavaScript

1 Answer

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

 



answered Jun 8, 2022 by avibootz

Related questions

1 answer 157 views
1 answer 116 views
1 answer 115 views
2 answers 380 views
1 answer 108 views
...