-
-
Save gbradley/5016026 to your computer and use it in GitHub Desktop.
| var x = '/x/'; | |
| /x/==x |
| function x(){ | |
| return ++x.i < 6 ? x : true; | |
| } | |
| x.i=0; | |
| x() === x()() === x()()() |
| var x = { | |
| i : false, | |
| toString: function(){ | |
| this.i = !this.i; | |
| return this.i ? 3 : -3; | |
| }}; | |
| x > 2 && x < 2 |
| /*var X = function(){}; | |
| Object.defineProperty(X.prototype, "a", { | |
| get : function(){ | |
| return true; | |
| } | |
| }); | |
| var x = new X();*/ | |
| function X(){} | |
| X.prototype.a = true; | |
| var x = new X(); | |
| delete x.a && x.a; |
| /*var x = '0';*/ | |
| var x = {}; | |
| x["[object Object]"] = x; | |
| x[x]==x |
| var x = function(){ | |
| x = ''; | |
| }; | |
| typeof new x < typeof x |
| var x = Infinity; | |
| x - 1 === x + 1 |
Curses! Real solution was much simpler :)
Sorry to bust another bubble, but your solution to 5.js also relies on non-ES5 (the array-access to characters of strings wasn't added officially until ES5 and doesn't work in several ES3 browsers).
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String#section_5
:)
...but i definitely prefer your solution to 6.js to mine. same idea, your's is simpler. :)
for 2.js I would suggest
function x() {
return x;
}
x() === x()()()()()()()()()()()()()(); // true
@aborjinos -- but that misses the spirit of that question...
x() === x()() === x()()()
Your proposed solution would be insufficient because this would fail, because the first assignment results in a boolean true, and so the second comparison would fail because true !== function.
@getify -- yeah you are right
so I can add 8.js :)
if the following is true what is x?
x(x) === x(x)(x)(x)
@aborjinos -- function x(y) { return y; }
@getify - damn you're right. Updated now!
Nice work!!
Object.definePropertyis ES5 though D: