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 144 views
2 answers 261 views
1 answer 139 views
1 answer 130 views
1 answer 114 views
1 answer 118 views
...