How to cast to int in JavaScript

1 Answer

0 votes
const a = 10;
const b = 3;
     
console.log(a / b)     
console.log(Math.trunc(a / b));
 
 
 
 
 
/*
run:
 
3.3333333333333335
3
 
*/

 



answered Jan 9, 2022 by avibootz

Related questions

1 answer 285 views
1 answer 276 views
1 answer 235 views
1 answer 272 views
1 answer 204 views
1 answer 208 views
208 views asked May 30, 2023 by avibootz
...