A simple trick for swapping array elements in JavaScript.
It works with any number of array items.
❗️ Important:
Make sure to iterate indices on the left side (0, 1, 2, ...) and choose the new index order on the right side only.
❗️ But:
Be mindful, mutating arrays (like here) is not good practice!