How to use floor to get the closest integer which is less than or equal to specified value in TypeScript

1 Answer

0 votes
console.log(Math.floor(4)); 
console.log(Math.floor(4.14)); 
console.log(Math.floor(4.4)); 
console.log(Math.floor(4.5)); 
console.log(Math.floor(4.6)); 
console.log(Math.floor(4.99)); 

console.log(Math.floor(-4)); 
console.log(Math.floor(-4.14)); 
console.log(Math.floor(-4.4)); 
console.log(Math.floor(-4.5)); 
console.log(Math.floor(-4.6)); 
console.log(Math.floor(-4.99)); 
          
     
     
   
/*
run:
   
4 
4 
4 
4 
4 
4 
-4 
-5 
-5 
-5 
-5 
-5
   
*/

 



answered Aug 7, 2022 by avibootz
...