How to convert float to int in JavaScript

1 Answer

0 votes
const n = Math.trunc(3.14);

console.log(n); 

const a = Math.trunc(16 / 3);

console.log(a); 



/*
run:

3
5

*/

 



answered Apr 7, 2021 by avibootz
...