function swap(array, from, to) {
  // ES6 array destructing
  [array[from], array[to]] = [array[to], array[from]];
}
Swap array elements in place
Runtime: O(1)
@param {array} array to be modified
@param {integer} from index of the first element
@param {integer} to index of the 2nd element