<script> //第一种方法 var a = 2; var b = 3; var c = a; a = b; b = c; console.log(a); console.log(b); //第二种方法 var a = 2; var b = 3; a = a + b; //5 b = a - b; //5-3 a = a - b; //5-2 console.log(a); console.log(b); </script>