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 139 views
1 answer 132 views
1 answer 124 views
1 answer 148 views
2 answers 142 views
...