Created
April 6, 2018 09:54
-
-
Save eugenserbanescu/815a5863ae94109c2866f31bfb27cd20 to your computer and use it in GitHub Desktop.
reference equality
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
function compare(a,b) { | |
return a == b; | |
} | |
function compareStrict(a,b) { | |
return a === b; | |
} | |
let a = {a:1} | |
compare(a,a) // true | |
compareStrict(a,a) // true | |
compare(a,{a:1}) // false | |
compareStrict(a,{a:1}) // false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment