Count total bits in a number | JavaScript program to find total bit in given number ; log function in base 2 take only integer part ; Driven program
function countBits ( number ) { return Math . floor ( Math . log2 ( number ) + 1 ) ; } let num = 65 ; document . write ( countBits ( num ) ) ;