Comparing leading zeros in binary representations of two numbers | Function to compare the no . of leading zeros ; if both have same no . of leading zeros ; if y has more leading zeros ; Main Function
function LeadingZeros ( x , y ) { if ( ( x ^ y ) <= ( x & y ) ) document . write ( " " ) ; else if ( ( x & ( ~ y ) ) > y ) document . write ( y ) ; else document . write ( x ) ; } let x = 10 , y = 16 ; LeadingZeros ( x , y ) ;