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 204 views
1 answer 182 views
1 answer 150 views
1 answer 187 views
1 answer 108 views
1 answer 123 views
123 views asked May 30, 2023 by avibootz
...