-
-
Save screamy/5019205 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
/x/==x | |
var x = '/x/'; |
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
x() === x()() === x()()() | |
for first comparison should be returned the same value | |
for second - true | |
function x () { | |
x.times = ++x.times || 1; | |
return x.times > 5 ? true : x; | |
} | |
x() === x()() === x()()() |
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
x > 2 && x < 2 | |
valueOf property should be overwritten to cast object to primitive | |
var x = { | |
reverse: -1, | |
val: -10, | |
valueOf: function () { | |
this.val = this.reverse * this.val; | |
return this.val; | |
} | |
} |
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
delete x.a && x.a; |
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
x[x]==x | |
var x = {} | |
x["[object Object]"] = x |
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
typeof new x < typeof x | |
typeof return as result string, charCodeAt using for string comparison | |
function x () { | |
x = 1; | |
return function () {}; | |
} |
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
x - 1 === x + 1 | |
var x = { | |
val: -1, | |
valueOf: function () { | |
return (this.val = ~this.val + 1); | |
} | |
}; | |
/* | |
var x = { | |
times: 0, | |
valueOf: function () { | |
++this.times; | |
return this.times%2 ? 1 : -1; | |
} | |
}; | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment