Mutating Arrays

When mutating an array, like reordering items with a swap. Always make sure to preform the operations on a fresh array. Global constants can be used in tests and things will go haywire quickly if the mutations cause side-effects outside invokations. The solution is to use spread before you perform a swap like so:

const myNewArray = [...myOldArray];
// Two way swap here