Why 3 > 2 > 1 gives false
Recently, I saw this question about how does Javascript evaluate an expression:
https://twitter.com/GwagsiG/status/1303981215461105670?ref_src=twsrc%5Etfw
So, why does 1 < 2 < 3 give true, but 3 > 2 > 1 give false? According to operator precedence an...
kahdev.hashnode.dev2 min read
Mark
Useful warning to prevent this pitfall!
Some languages like Python understand this syntax (so that
1 < 2 < 3is the same as1 < 2 and 2 < 3). Many others give an error. I think Javascript's behaviour is an unfortunate mistake.