标签:
(function(){ var a = 10, b = 2; a = a + b; b = a - b; a = a - b; alert(a+" "+b); })(); (function(){ var a = 10,b=2; a = a^b; b = b^a; a = a ^b; alert(a+" "+b); })(); (function(){ var a =10,b =2 ; a=[a,b]; b=a[0]; a=a[1]; alert(a+" "+b) })(); //简化一下: (function(){ var a =10,b =2 ; a=[b,b=a][0]; alert(a+" "+b) })(); (function(){ var a = 10,b = 2; a = {a : b, b : a}; b = a.b; a = a.a; alert(a+" "+b); })(); (function(){ var a = 10,b = 2; a=(function(){ try { return b; } finally { b = a; } })(); alert(a+" "+b); })(); (function(){ var a = 10,b = 2; eval("a="+b+";b="+a); alert(a+" "+b); })(); (function(){ var a =10,b =2 ; a = b+(b = a)*0; alert(a+" "+b) })(); (function(){ var a =10,b =2 ; a = (a + b) - (b = a); alert(a+" "+b) })();
标签:
原文地址:http://my.oschina.net/oospace/blog/359864