JPDev@programming.dev to Programmer Humor@programming.dev · 9 months ago===programming.devimagemessage-square54fedilinkarrow-up1651arrow-down117
arrow-up1634arrow-down1image===programming.devJPDev@programming.dev to Programmer Humor@programming.dev · 9 months agomessage-square54fedilink
minus-squarekevincox@lemmy.mllinkfedilinkarrow-up18arrow-down1·9 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"