-
-
Save porqz/5023919 to your computer and use it in GitHub Desktop.
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
| var x = "/x/"; | |
| /x/==x |
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
| var x; | |
| // My version | |
| x = function () { | |
| if (x.times > 4) { | |
| return true; | |
| } | |
| else { | |
| x.times = (x.times || 0) + 1; | |
| return x; | |
| } | |
| }; | |
| // Version of @cjwainwright, right version | |
| x = function () { | |
| return function () { | |
| return function () { | |
| return false; | |
| }; | |
| }; | |
| }; | |
| x() === x()() === x()()() |
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
| // Very stupid solution, but I have no another idea (yet) | |
| var x = { | |
| valueOf: function () { | |
| if (!this.valueOf.wasCalled) { | |
| this.valueOf.wasCalled = true; | |
| return 3; | |
| } | |
| else { | |
| this.valueOf.wasCalled = false; | |
| return 1; | |
| } | |
| } | |
| }; | |
| x > 2 && x < 2 |
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
| var x = (function () { | |
| var SomeConstructor = function () {}; | |
| SomeConstructor.prototype.a = true; | |
| return new SomeConstructor(); | |
| })(); | |
| delete x.a && x.a; |
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
| var x; | |
| // The first version | |
| x = { | |
| "[object Object]": "Some primitive value", | |
| valueOf: function () { | |
| return this["[object Object]"]; | |
| } | |
| }; | |
| // The second, deeper version | |
| x = { | |
| value: "Some primitive value", | |
| toString: function() { | |
| return "value"; | |
| }, | |
| valueOf: function () { | |
| return this.value; | |
| } | |
| }; | |
| // The third (right) version (not mine) | |
| x = "0"; | |
| // The 4th (stupid but brilliant) version (not mine) | |
| x = {}; | |
| x[x] = x; | |
| // The 5th version (not mine) | |
| x = { | |
| "[object Object]": "[object Object]" | |
| }; | |
| x[x]==x |
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
| var x = function () { | |
| x = 1; | |
| }; | |
| typeof new x < typeof x |
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
| var x = Infinity; | |
| x - 1 === x + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment