How to swap two numbers without using a temporary variable ? | Swap function ; Driver code
function swap ( xp , yp ) { xp [ 0 ] = xp [ 0 ] ^ yp [ 0 ] ; yp [ 0 ] = xp [ 0 ] ^ yp [ 0 ] ; xp [ 0 ] = xp [ 0 ] ^ yp [ 0 ] ; } let x = [ 10 ] ; swap ( x , x ) ; document . write ( " " + x [ 0 ] ) ;