Created
February 18, 2012 01:26
-
-
Save chuckha/1856747 to your computer and use it in GitHub Desktop.
javascript string and integer addition/concatenation
This file contains hidden or 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
// The first three are strings, the last is a number | |
"1" + "2" = "12"; | |
"1" + 2 = "12"; | |
1 + "2" = "12"; | |
1 + 2 = 3; | |
// These are all numbers | |
"1" - 2 = -1; | |
"1" - "2" = -1; | |
1 - "2" = -1; | |
1 - 2 = -1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment