swapArrayElement(arr, elem1, elem2) {
    const index1 = typeof elem1 === 'number' ? elem1 : arr.indexOf(elem1);
    const index2 = typeof elem2 === 'number' ? elem2 : arr.indexOf(elem2);
    const temp = arr[index1];

    arr[index1] = arr[index2];
    arr[index2] = temp;
    return arr;
  }
Swap two elements of an array
@param {array} arr - target array
@param {any} elem1 - an element
@param {any} elem1 - other element
@return {array} Original array
@public