Skip to content

Instantly share code, notes, and snippets.

@porqz
Forked from padolsey/1.js
Last active December 14, 2015 03:49
Show Gist options
  • Save porqz/5023919 to your computer and use it in GitHub Desktop.
Save porqz/5023919 to your computer and use it in GitHub Desktop.
var x = "/x/";
/x/==x
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()()()
// 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
var x = (function () {
var SomeConstructor = function () {};
SomeConstructor.prototype.a = true;
return new SomeConstructor();
})();
delete x.a && x.a;
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
var x = function () {
x = 1;
};
typeof new x < typeof x
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