方式1 临时变量法
let a = 3
let b = 5
let temp = a;
a = b;
b = temp
let a = 3
let b = 5
a = a + b // 3 + 5 此时a , 为原a + b ,我们称和 总和
b = a - b // 8 - 5 求差,获得原a的值也就3, 赋值给b
a = a - b // 8 - 3 此时 b 已经是原a的值, 总-b 求差,可以获得 原b的值
let a = 3
let b = 5
let arr = [a,b]
[b,a] = [a,b]
let a = 3
let b = 5
let arr = [a,b]
b = arr[0]
a = arr[1]
var obj = {a:b,b:a}
a = obj.b
b = obj.a
let a =3
let b = 5
a = [b,b=a][0]
let a =3
let b = 5
a = a^b
b= b^a
a = a^b