Last active
July 24, 2017 20:59
-
-
Save tekaratzas/953a556f720edf39173aff2701921ea1 to your computer and use it in GitHub Desktop.
Difference between "==" and "===" in JS.
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
// examples with == | |
1 == "1" // true | |
"/t" == 0 // true | |
"34" == 2 // false | |
new Number(10) == 10 // true | |
Number(10) === 10 //true | |
// examples with === | |
1 === "1" // false | |
"/t" === 0 // false | |
"34" === 2 // false | |
10 === 10 //true | |
// where things get wierd.... | |
Number(10) === 10 //true | |
new Number(10) === 10 //false, LHS will actually be an object! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In line 4 there is an error.
Maybe you mean this