let a = 1, b = 2 [a, b] = [b, a] console.log(a) // -> 2 console.log(b) // -> 1
let myArray = [12, -2, 55, 68, 80]; [myArray[0], myArray[1]] = [myArray[1], myArray[0]]; console.log(myArray); // [-2,12,55,68,80]