Hacker News new | ask | show | jobs
by vqrs 2927 days ago
I'm not sure how what you linked is related, but the only "surprising" thing here is probably `true == 1`. This evaluates to true, and because comparisons are left-associative, we have `(true == 1) === true` which reduces to `true === true`, which, unsurprisingly, is true.
1 comments

Agree. It was my point. `true 0== 1` resolves to true, but shouldn't so `true == 1 === true` should be false but is true, which could at the very least be called ambiguous to people not familiar with the language. It may reflect somewhat badly on Brendan since they felt compelled to introduce === to rectify this. Personally I think it made the language richer, with more options to chose from depending on circumstance, and it was more like an adaption to the new uses for js.