const swap = (array, index1, index2) => {
    // store a tmp variable at pos index2
    const tmp = array[index2];

    // set value  of index2 to our value at index