JS comparison

x = 10;
y = 5;
alert(x > y);

Why does it not alert “10 > 5” but “true” ?

because the comparison is resolved first, the result of comparison is then displayed in an alert message

to achieve what you want, use a string (with variable if you want)

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.