js array swap items with index code example
Example 1: javascript switch items in array
var b = list[y];
list[y] = list[x];
list[x] = b;
Example 2: javascript swap array elements
var b = list[y];
list[y] = list[x];
list[x] = b;
var b = list[y];
list[y] = list[x];
list[x] = b;
var b = list[y];
list[y] = list[x];
list[x] = b;