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 134 views
2 answers 254 views
1 answer 134 views
1 answer 126 views
1 answer 112 views
1 answer 111 views
...