OsrsNeedsF2P to Programmer Humor · 1 year agoYup, Javascript can go F@#! itselfimagemessage-square39fedilinkarrow-up1141arrow-down14
arrow-up1137arrow-down1imageYup, Javascript can go F@#! itselfOsrsNeedsF2P to Programmer Humor · 1 year agomessage-square39fedilink
minus-squareBjörn Tantau@feddit.delinkfedilinkarrow-up1·1 year agoCan someone explain this? I mean, the last result. Usually I can at least understand Javascript’s or PHP’s quirks. But this time I’m stumped.
minus-squaremycus@kbin.sociallinkfedilinkarrow-up5·edit-21 year agoJS null and undefined shenanigans basically: bigger an lesser comparison types convert null to zero, so is zero bigger or lesser than zero? no == is fucky and to it null only equals undefined and undefined only equals null (and themselves), so no is zero bigger than or equal to zero? yeah
minus-squareBjörn Tantau@feddit.delinkfedilinkarrow-up1·1 year agoUgh, thanks, of course. Stupid brain.
minus-squaremycus@kbin.sociallinkfedilinkarrow-up1·1 year agoI’m starting to think JS maintainers have a thing against mathematicians
minus-squareomnislayer88@kbin.sociallinkfedilinkarrow-up2·1 year agoMy only thought here might be >= is usually the same as !< and maybe thats how it is defined in javascript and since < is false than >= == !false == true
minus-squareSerdan@lemm.eelinkfedilinkarrow-up2·edit-21 year agoI would guess null is coerced to a number
Can someone explain this? I mean, the last result. Usually I can at least understand Javascript’s or PHP’s quirks. But this time I’m stumped.
JS null and undefined shenanigans
basically:
==
is fucky and to it null only equals undefined and undefined only equals null (and themselves), so noUgh, thanks, of course. Stupid brain.
I’m starting to think JS maintainers have a thing against mathematicians
more likely against humans
My only thought here might be >= is usually the same as !< and maybe thats how it is defined in javascript and since < is false than >= == !false == true
I would guess null is coerced to a number