Check whether K | Javascript program to check if k - th bit of a given number is set or not using right shift operator . ; Driver Code
function isKthBitSet ( n , k ) { if ( ( ( n >> ( k - 1 ) ) & 1 ) > 0 ) document . write ( " " ) ; else document . write ( " " ) ; } let n = 5 , k = 1 ; isKthBitSet ( n , k ) ;