Created
August 22, 2020 10:32
-
-
Save iamsaief/ee4ba8b4442f679c6fd93c8b7db45cce 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
/* 👎 double equal == */ | |
const first = 1; | |
const second = "1"; | |
if (first == second) { | |
console.log(true, `${first} == ${second}`); | |
} else { | |
console.log(false, `${first} != ${second}`); | |
} | |
// Output : true 1 == 1 | |
/* 👍triple equal === */ | |
const first = 1; | |
const second = "1"; | |
if (first === second) { | |
console.log(true, `${first} == ${second}`); | |
} else { | |
console.log(false, `${first} != ${second}`); | |
} | |
// Output : false 1 != 1 | |
/* 🤔 implicit type conversion, double equal == */ | |
const first = 1; | |
const second = true; | |
if (first == second) { | |
console.log(true, `${first} == ${second}`); | |
} else { | |
console.log(false, `${first} != ${second}`); | |
} | |
// Output : true 1 == true 😮 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment