Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Semrush - keyword research tool

Linux Foundation Training and Certification

Teach Your Child To Read

Disclosure: My content contains affiliate links.

32,304 questions

42,479 answers

573 users

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

1 Answer

0 votes
const num = 5668;
 
console.log(("0000000000000000" + num.toString(2)).substr(-16));
 
console.log(num.toString(2));

 
 
/*
run:
 
0001011000100100
1011000100100
 
*/

 



Learn & Practice Python
with the most comprehensive set of 13 hands-on online Python courses
Start now


answered Jan 11, 2023 by avibootz
edited Apr 6 by avibootz

Related questions

1 answer 39 views
1 answer 51 views
1 answer 49 views
2 answers 52 views
...