Created
February 21, 2020 20:08
-
-
Save trycf/2effd5850860f9f0ec56fb4a99780475 to your computer and use it in GitHub Desktop.
TryCF Gist
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
<cfscript> | |
system=createOBject('java','java.lang.System') | |
// "True" test of === | |
a=5 | |
b=2+3 | |
dump(a==b) | |
dump(a===b) | |
c='test' | |
d=['te','st'].toList('') | |
dump(c==d) | |
dump(c===d) | |
// Objects being compared are not the same on heap | |
dump(system.identityHashCode(a)) | |
dump(system.identityHashCode(b)) | |
dump(system.identityHashCode(c)) | |
dump(system.identityHashCode(d)) | |
// Ben's test that doens't do what you think it does | |
e=5 | |
f=5 | |
dump(e==f) | |
dump(e===f) | |
g='test' | |
h='test' | |
dump(g==h) | |
dump(g===h) | |
// Objects are the same on heap!! | |
dump(system.identityHashCode(e)) | |
dump(system.identityHashCode(f)) | |
dump(system.identityHashCode(g)) | |
dump(system.identityHashCode(h)) | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment