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