JPDev@programming.dev to Programmer Humor@programming.dev · 1 year ago===programming.devimagemessage-square39fedilinkarrow-up1392arrow-down112
arrow-up1380arrow-down1image===programming.devJPDev@programming.dev to Programmer Humor@programming.dev · 1 year agomessage-square39fedilink
minus-squarekevincox@lemmy.mllinkfedilinkarrow-up13·1 year agoJS’s == has some gotchas and you almost never want to use it. So === is what == should have been. All examples are true: "1" == true [1, 2] == "1,2" " " == false null == undefined It isn’t that insane. But some invariants that you may expect don’t hold. "" == 0 "0" == 0 "" != "0"
JS’s
==
has some gotchas and you almost never want to use it. So===
is what==
should have been.All examples are true:
"1" == true [1, 2] == "1,2" " " == false null == undefined
It isn’t that insane. But some invariants that you may expect don’t hold.
"" == 0 "0" == 0 "" != "0"