Swap variables in JavaScript: 2 ways to do it

There are 2 typical ways to swap variables. The modern way (since ES2015) works like so:

let a = 'apple';
let b = 'banana';
console.log(a, b); // "apple" "banana"
[b, a] = [a, b];
console.log(a, b); // "banana" "apple"

Check MDN if you want to learn more about array destructuring.

The other option is the traditional way, where you use a temporary variable to do the swap:

let a = 'apple';
let b = 'banana';
console.log(a, b); // "apple" "banana"

// We need another variable because when you assign a new value,
// it overwrites the old value.
let temporaryA = a;
a = b;
b = temporaryA;
console.log(a, b); // "banana" "apple"

And this is what happens without the extra variable:

let a = 'apple';
let b = 'banana';
console.log(a, b); // "apple" "banana"

a = b; // a is now "banana" and there are no more variables with "apple".
b = a;
console.log(a, b); // "banana" "banana"

Everything becomes bananas!

Questions

What's console output?

let v1 = 1;
let v2 = 2;
[v2, v1] = [v1, v2];

console.log(v1, v2);

What's console output?

let v1 = 5;
let v2 = 6;

const t1 = v1;
v1 = v2;
v2 = t1;

console.log(v1, v2);

What's console output?

let v1 = 8;
let v2 = 9;

v1 = v2;
v2 = v1;

console.log(v1, v2);