O'Reilly logo
  • Nivan Morgan thinks this is interesting:

+, ==, != and the relational operators are the only ones that perform this special kind of string-to-primitive conversions. Other operators convert more explicitly to a specified type and do not have any special case for Date objects. The - operator, for example, converts its operands to numbers. The following code demonstrates the behavior of +, -, ==, and > with Date objects:


Cover of JavaScript: The Definitive Guide, 6th Edition


very important and very messy