DEV Community


Discussion on: Do you know these weird parts of JavaScript?

ralphkay profile image
Raphael Amponsah • Edited

Some of these have got to do with associativity, coercion and auto semicolon insertion.
3>2>1 this is based on left
right asociativity of the > operator 3>2 is evaluated first, which will be true and when we evaluate true >1 it will be false coz true is equal to 1 not greater.

After a return key if the interpreter does not find anything there will be an automatic semicolon insertion and returning nothing like that in the example will be undefined. All the code below the return key would be ignored.

ralphkay profile image
Raphael Amponsah

But the language is interestingly weird! I think we can call it WeirdScript :)