While I was messing around with truth tables in JavaScript, I noticed that the following evaluates to true:
var a, b, c;
a = {};
b = function(){};
c = a < b;
console.log(c);
Why?
I’ve only tested this in Firefox, and I’m sure I could dig up the details in the ECMAScript 2.6.2 spec, but TBH I’m feeling lazy.
JavaScript type coercion makes the comparison essentially
so essentially you are just doing
which is a lexicographic string comparison.