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

1 answer 272 views
1 answer 200 views
1 answer 231 views
3 answers 436 views
...