text: Toggling k | Javascript program to toogle k - th bit of a number ; Driver code
code: function toggleKthBit ( n , k ) { return ( n ^ ( 1 << ( k - 1 ) ) ) ; } let n = 5 , k = 1 ; document . write ( toggleKthBit ( n , k ) ) ;