Last active
May 15, 2021 13:06
-
-
Save rajat2502/d4fa0484df776d0d5272a6ceef7d9c83 to your computer and use it in GitHub Desktop.
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
var x = 10; | |
var y = "10"; | |
// Case 1: when the variables are added | |
console.log(x + y); | |
// Output: 1010 | |
// Case 2: when the variables are subtracted | |
console.log(x - y); | |
// Output: 0 | |
/* When a number and string are to be added then the number is converted into a string but | |
when they are to be subtracted the string is converted into a number. */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment