Simple JS question: 10 > 9 > 8 === true; returns false.
Can somebody please elaborate and explain?
Thanks in advance!
Simple JS question: 10 > 9 > 8 === true; returns false.
Can somebody please elaborate and explain?
Thanks in advance!
Please find answer Below:
10 > 9 > 8 === true;
The > operator has a higher precedence than === and is left-to-right associative. If we add the implicit parentheses we get this:
((10 > 9) > 8) === true;
This evaluates further to:
((10 > 9) > 8) === true;
(true > 8) === true;
(1 > 8) === true;
false === true;
false;