How to swap two numbers without using a temporary variable ? | Function to swap the numbers . ; same as a = a + b ; same as b = a - b ; same as a = a - b ; Driver Code ; Function Call
function swap ( a , b ) { a = ( a & b ) + ( a b ) ; b = a + ( ~ b ) + 1 ; a = a + ( ~ b ) + 1 ; document . write ( " " + a + " " + b ) ; } let a = 5 , b = 10 ; swap ( a , b ) ;