elemen array swap lodash
const swapArrayLocs = (arr, index1, index2) => {
[arr[index1], arr[index2]] = [arr[index2], arr[index1]]
}
Outrageous Orangutan
const swapArrayLocs = (arr, index1, index2) => {
[arr[index1], arr[index2]] = [arr[index2], arr[index1]]
}
var b = list[y];
list[y] = list[x];
list[x] = b;