a = 1;
b = 2;
// method 1
[a, b] = [b, a]
// method 2
// b = [a, (a = b)][0];
// method 3
// or use destructuring
// [b] = [a, (a = b)];
console.log(a, b);
a = 1;
b = 2;
// method 1
[a, b] = [b, a]
// method 2
// b = [a, (a = b)][0];
// method 3
// or use destructuring
// [b] = [a, (a = b)];
console.log(a, b);