es5 bug, operator == and valueOf

Jason Orendorff jason.orendorff at
Wed Dec 1 08:48:04 PST 2010

On Wed, Dec 1, 2010 at 2:45 AM, Peter van der Zee <ecma at> wrote:
> Has an operator like >== ever been proposed? So the "strict" relational
> operator that returns NaN if typeof left and right don't match.
> If so, why was it shot down? Bloat? Relatively useless?

Well, > is used more often than >=. How would you spell "strict >"?

I think when people use >, >=, etc. they almost always suppose
(correctly or incorrectly) that the operands are sure to be both
numbers (or both strings). If they aren't, the programmer's
assumptions have already been violated; the code will likely misbehave
whatever answer the language gives. That is, even if the language
provided strict comparisons, and people used them, it probably
wouldn't help. This stands in contrast to code like `if (x ==
undefined)` where there may be no presupposition at all about what
sort of value x is.


More information about the es-discuss mailing list