JPDev@programming.dev to Programmer Humor@programming.dev • 10 months ago===imagemessage-square16 fedilinkarrow-up1236
arrow-up1236image===JPDev@programming.dev to Programmer Humor@programming.dev • 10 months agomessage-square16 Commentsfedilink
minus-squarekevincox@lemmy.mlhexbear9·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" linkfedilink
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"