Can (a == 1 && a == 2 && a == 3) Ever Evaluate to 'true'? stackoverflow.com/q/48270127/3951 (Not very useful but it turns out, yes, it's possible to make it happen in JavaScript.)
@JavaScriptDaily let a = {foo: 0, valueOf: function () { return ++this.foo }}
@JavaScriptDaily On of the tricky question I ever seen!!
@JavaScriptDaily a = true. Hilarious type juggling ensues.
@JavaScriptDaily Frankly I find it a useless, "lawyer" question - it is one in a gazillion to hit it in real life, less than 10 people will ever benefit of this knowledge, it bloats corner-case-theoretical questions, but it is considered pro-knowledge. Useful if you will create ES-10, probably...
@JavaScriptDaily That's why you gotta === every time! Like the billboard says: "==: not even once".
@JavaScriptDaily it should be incrementing object field and overriding valueOf ) but I knew that it's possible, that is always easier
@JavaScriptDaily thats really cool haha, so a friend of mine made a nice answer in C++ : struct{ bool operator== (const int content) const { return true } } a; int main(){ if (a == 1 && a == 2 && a ==3) printf("worked"); return 0 }