Find the value of N XOR 'ed to itself K times | Function to return n ^ n ^ ... k times ; Find the result ; Driver code
function xorK ( n , k ) { let res = n ; for ( let i = 1 ; i < k ; i ++ ) res = ( res ^ n ) ; return n ; } let n = 123 , k = 3 ; document . write ( xorK ( n , k ) ) ;