Last active
July 3, 2018 09:54
-
-
Save langjt/96841a14805418ef68fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* a,b两个变量,不用第三个变量来交换两个变量的值 */ | |
// a,b为数字 | |
var a = 1, | |
b = 2; | |
a = a + b; | |
b = a - b; | |
a = a - b; | |
// a,b为字符串或其他类型 | |
var a = 'a'; | |
b = 'b'; | |
a = [a, b]; | |
b = a[0]; | |
a = a[1]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment