Error Code
let a = 5
let b = 10
[a, b] = [b, a]; // ES6
console.log(a, b);
throw errro: Uncaught ReferenceError: b is not defined at :3:5
Running at Chrome Console, also throw error in Node.js
Valid Code
let a = 5;
let b = 10;
[a, b] = [b, a]; // ES6
console.log(a, b);
The difference is the semicolon in two let statements.