-
-
Save cjwainwright/5016776 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 |
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
var x = function (){ | |
return function(){ | |
return function() { | |
return false; | |
}; | |
}; | |
}; | |
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
var x = { | |
valueOf : function(){ | |
this.valueOf = function(){ return 1; } | |
return 3; | |
} | |
}; | |
x > 2 && x < 2 |
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
function f(){} | |
f.prototype = {a: true}; | |
var x = new f(); | |
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
var x = {}; | |
x[x] = 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
var x = function(){ x = ''; } | |
typeof new x < typeof 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
var x = Infinity; | |
x - 1 === x + 1 |
@cjwainwright 1.js is stupidly easy. odds are you're over-thinking it. it's got a red herring in it. ;-)
@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
@getify Ha thanks! Unfortunately 1.js had me stumped.