JPDev@programming.dev to Programmer Humor@programming.dev · 10 months ago===programming.devimagemessage-square68fedilinkarrow-up1690arrow-down116
arrow-up1674arrow-down1image===programming.devJPDev@programming.dev to Programmer Humor@programming.dev · 10 months agomessage-square68fedilink
minus-squarekevincox@lemmy.mllinkfedilinkarrow-up18arrow-down1·10 months 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"