<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="utf-8" />
<meta name="referrer" content="never">
<title>值互换 不用第三方变题的前提</title>
</head>
<body>
</body>
</html>
var a = 10, b = 15;
console.debug(`原始值 ${a} ${b}`);
[b, a] = [a, b];
console.debug(`替换后 ${a} ${b}`)
var x = 50, y = 100;
console.debug(`原始值 ${x} ${y}`);
x = y + (y = x) * 0;
console.debug(`替换后 ${x} ${y}`)
var i = 1, j = 2;
console.debug(`原始值 ${i} ${j}`);
i = i + j;
j = i - j;
i = i - j;
console.debug(`替换后 ${i} ${j}`)