Notes icon indicating copy to clipboard operation
Notes copied to clipboard

2个数值互相切换的最短代码

Open any86 opened this issue 6 years ago • 0 comments

var n1 = 1,n2=2, active=n1;
for(let i = 0;i<10;i++){
    active = n1^n2^active;
    console.log(`第${i}次`, active)
}

image

any86 avatar Feb 15 '19 01:02 any86