//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种则适用性更广。
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn