2 ms·
Python evaluates `2 == 2 == 2` to true. JavaScript evaluates the same to false. Somehow we've decided that Python is the weird one it seems.
by Buttons840 2y ago
Python evaluates `2 == 2 == 2` to true. JavaScript evaluates the same to false. Somehow we've decided that Python is the weird one it seems.
- pcthrowaway 2y ago1 == 1 == 1 is actually true in Javascript due to type coercion You're probably thinking `1 === 1 === 1` which is indeed false
- dartharva 2y agoI tried 2 == 2 == 2 in my browser's (Chrome) console and it evaluated to false.
- Buttons840 2y agoI stealth edited my post. Sorry.
- throwaway313373 2y agoTo be fair, there are edge cases [0] when it does look weird. [0] https://github.com/satwikkansal/wtfpython?tab=readme-ov-file#-be-careful-with-chained-operations https://github.com/satwikkansal/wtfpython?tab=readme-ov-file...
- recursive 2y agoNot in my browser console. (but it's true for a different reason)