Q:

Explain how JavaScript evaluate this code

(true + false) > 2 + true;
I run this on Chrome console debugger and the result is false.
But,
true + false = 1
1 > 2 = false
false + true = 1

Can someone explain why the answer is false?

A:

> (greater than) has operator precedence 11, whereas + has operator precedence 12. See MDN for a table. So:
(true + false) > 2 + true;

is equivalent to
(true + false) > (2 + true);
(1) > (2 + true);
(1) > (3);
1 > 3
false

