Returns the provided array with two items' positions swapped
function swapItems<T>(arr: T[], index1: number, index2: number)
// Example:
swapItems([0, 1, 2, 3, 4], 1, 3) //=> [0, 3, 2, 1, 4]
Returns the provided array with two items' positions swapped
function swapItems<T>(arr: T[], index1: number, index2: number)
// Example:
swapItems([0, 1, 2, 3, 4], 1, 3) //=> [0, 3, 2, 1, 4]