Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict"
- let countBits = function(n) {
- n = (n).toString(2);
- let arr = n.split("");
- let count = 0;
- for (let a of arr) {
- if (+a == 1) {
- ++count
- }
- }
- console.log(count);
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement