时间:2021-07-01 10:21:17 帮助过:3人阅读
//by ppchen
var a = 10, b = 2;
a = a + b;
b = a - b;
a = a - b;
代码如下:
//by Mr.司马
var a = 10000,b=245
a = a^b;
b = b^a;
a = a ^b;
代码如下:
//by cloudgamer
var a = 33,b=44
a=[a,b]
b=a[0]
a=a[1]
代码如下:
//by Mr.司马
var a = 23,b=454;
a = {a:b,b:a};
b = a.b;
a = a.a;
评:1、2种解法是普遍解,只能交换数字,而3、4种则适用性更广。