a is going to be the value of b and b is going to be the value of a. So a is going to be b and b is going to be a. So you are trying to assign b to a and a to b. So…
It’s a little bit hard to grok at first, but once it clicks the syntax should be quite clear.
The actual task (swapping variables) is not something that needs to be done very often, but it’s a common example problem because it shows how destructuring can make clear what’s happening. To swap two variables without destructuring:
let a = 6;
let b = 8;
let temp;
temp = a; // make sure don't lose a
a = b; // now they are both 8
b = temp; // now b is 6
With destructuring, you just say a is b and b is a, there’s no need to use a temporary variable