方法一.ES6解构
let [a,b] = [10,20]; [a,b] = [b,a]
方法二.利用数组特性进行交换
let a = 10 , b = 20; a = [a,b] b = a[0] a = a[1]
方法三.算数运算(这个确保是number类型)
let a = 10 , b = 20; a = a + b b = a - b a = a - b