using arra method to swap position of array element javascript 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;