How to remove the decimal fraction of a number in JavaScript

1 Answer

0 votes
console.log(Math.trunc(-5.1));
console.log(Math.trunc(-5.9));
console.log(Math.trunc(7.1));
console.log(Math.trunc(7.9));




/*
run:
     
-5
-5
7
7
   
*/

 



answered Mar 12, 2020 by avibootz

Related questions

...