JPDev ( JPDev@programming.dev ) to Programmer Humor@programming.dev · 3 年前===programming.devimagemessage-square34linkfedilinkarrow-up1380
arrow-up1380image===programming.devJPDev ( JPDev@programming.dev ) to Programmer Humor@programming.dev · 3 年前message-square34linkfedilink
minus-squarekevincox ( kevincox@lemmy.ml ) linkfedilinkarrow-up11·3 年前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"
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 == undefinedIt isn’t that insane. But some invariants that you may expect don’t hold.
"" == 0 "0" == 0 "" != "0"