Write a function that takes an integer as input, and returns the number of bits that are equal to one in the binary representation of that number. You can guarantee that input is non-negative. javascript code example
Example 1: bit counting
countBits = (n) => n.toString(2).split("0").join("").length;
Example 2: find no of 1's in a binary number
len(''.join(str(bin(122011)).split('0')))-1