interchange 2 array element in javascript code example Example: exchange value between 2 items in array javascript var a = 1; var b = 2; [a,b] = [b,a];