How to print the bits of an integer in 32 bit format with TypeScript

1 Answer

0 votes
const num:number = 11987361;
 
console.log(("00000000000000000000000000000000" + num.toString(2)).substr(-32));

 
 
  
 
/*
run:
 
"00000000101101101110100110100001"
 
*/

 



answered Jan 12, 2023 by avibootz

Related questions

1 answer 228 views
2 answers 387 views
1 answer 240 views
1 answer 225 views
...