How to print the bits of an integer in 16 bit format with Node.js

1 Answer

0 votes
const num = 87216;
 
console.log(("0000000000000000" + num.toString(2)).substr(-16));
 
 
 
 
/*
run:
 
0101010010110000
 
*/
 
 

 



answered Jan 12, 2023 by avibootz

Related questions

1 answer 240 views
1 answer 228 views
1 answer 211 views
1 answer 233 views
2 answers 256 views
...