Reputation: 89233
Why is 5 > 4 > 3 != (5 > 4 && 4 > 3)
true in Javascript?
So annoying!
Upvotes: 5
Views: 550
Reputation: 27835
5 > 4 > 3
is evaluated like (5 > 4) > 3
, then it's true > 3
, which is false
. Look
Upvotes: 17
Reputation: 798716
JavaScript, in the great tradition of most languages that descend from C, does not support relational operator chaining.
Upvotes: 6