JavaScript program to swap the values of two variables using a temporary variable

python tutorials and learn python

Created with Sketch.

JavaScript program to swap the values of two variables using a temporary variable

let x = 5;
let y = 10;
let temp = x;
x = y;
y = temp;
console.log("The value of x after swapping is: " + x);
console.log("The value of y after swapping is: " + y);

Leave a Reply

Your email address will not be published. Required fields are marked *