const arr = [1,2,3,4]; [arr, arr] = [arr, arr]; console.log(arr);
On the right-hand side, we are creating a new array of
[3, 1]. We immediately use destructuring assignment to override the values at position
It's a good trick to swap elements that I thought I could share.
Thanks for reading!