P粉2129717452023-08-11 12:51:28
First you need to declare x and y first, and you need to use a semicolon after the statement in a line.
let x, y; [x, y] = [10, 20]; [y, x] = [x, y]; console.log(x, y)
EDIT: Sorry, you don't need to declare them beforehand, but use semicolons to separate the directives.