Today while doing an Exercism, I learned that through ES6 destructuring we can swap two array items in one line of code. Here’s how it works:
[array, array] = [array, array]
Items one and two are swapped in
array. Modify those values in-place like a boss.