text: Find most significant set bit of a number | Javascript program to find MSB number for given n . ; Driver code
code: function setBitNumber ( n ) { if ( n == 0 ) return 0 ; let msb = 0 ; n = n / 2 ; while ( n != 0 ) { n = $n / 2 ; msb ++ ; } return ( 1 << msb ) ; } let n = 0 ; document . write ( setBitNumber ( n ) ) ;