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

1 Answer

0 votes
const num = 10854261;

console.log(("00000000000000000000000000000000" + num.toString(2)).substr(-32));




/*
run:

"00000000101001011001111101110101"

*/

 



answered Jan 11, 2023 by avibootz
edited Jan 12, 2023 by avibootz

Related questions

1 answer 150 views
2 answers 269 views
1 answer 144 views
1 answer 140 views
1 answer 119 views
1 answer 130 views
...