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 143 views
2 answers 259 views
1 answer 138 views
1 answer 129 views
1 answer 114 views
1 answer 118 views
...