Skip to content

Instantly share code, notes, and snippets.

@cjwainwright
Forked from padolsey/1.js
Last active December 14, 2015 02:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjwainwright/5016776 to your computer and use it in GitHub Desktop.
Save cjwainwright/5016776 to your computer and use it in GitHub Desktop.
var x = function (){
return function(){
return function() {
return false;
};
};
};
x() === x()() === x()()()
var x = {
valueOf : function(){
this.valueOf = function(){ return 1; }
return 3;
}
};
x > 2 && x < 2
function f(){}
f.prototype = {a: true};
var x = new f();
delete x.a && x.a;
var x = {};
x[x] = x;
x[x]==x
var x = function(){ x = ''; }
typeof new x < typeof x
var x = Infinity;
x - 1 === x + 1
@getify
Copy link

getify commented Feb 22, 2013

wow, VERY nice solution to 2.js. :)

@cjwainwright
Copy link
Author

@getify Ha thanks! Unfortunately 1.js had me stumped.

@getify
Copy link

getify commented Feb 23, 2013

@cjwainwright 1.js is stupidly easy. odds are you're over-thinking it. it's got a red herring in it. ;-)

@cjwainwright
Copy link
Author

@getify Yeah, have since seen other's solutions. Don't know what I was thinking, hopefully I would've got it if it was ({}==x) or []==x. Anyway, it's made me re-check the spec for equality comparison, which is always a good thing :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment