I met a confuse problem when i use destructuring in javascript. Here is the code:
let a = 1
let b = 2
[b, a] = [a, b]
console.log([a, b])
I expect that variables a and b will exchange their value, but here throw a error, which is "ReferenceError: Cannot access 'b' before initialization". I cannot figure out why this happens.