return2ozma@lemmy.world to politics @lemmy.world · 11 months agoTexas Governor Greg Abbott declares that Texas law supercedes Federal authority and hints at secessionboingboing.netexternal-linkmessage-square305fedilinkarrow-up1572arrow-down114
arrow-up1558arrow-down1external-linkTexas Governor Greg Abbott declares that Texas law supercedes Federal authority and hints at secessionboingboing.netreturn2ozma@lemmy.world to politics @lemmy.world · 11 months agomessage-square305fedilink
minus-squareRandelung@lemmy.worldlinkfedilinkarrow-up3·11 months agoAs opposed to null and undefined?
minus-squareWrench@lemmy.worldlinkfedilinkarrow-up3arrow-down1·11 months agoNo one checks those values explicitly. if (str) checks if it’s not null, undefined, or empty string. Optional chaining like if (arr?.length) checks if list is undefined, null, or empty array. Falsy and truthy comparators seem fucky in the beginning when coming from a strongly typed language. But they’re very convenient when used properly.
minus-squareRandelung@lemmy.worldlinkfedilinkarrow-up1·11 months agoMonads exist, optional chaining has been around for ages, and implicit bool casts, too. As you said, no one checks those values explicitly.
As opposed to null and undefined?
No one checks those values explicitly.
if (str)
checks if it’s not null, undefined, or empty string.Optional chaining like
if (arr?.length)
checks if list is undefined, null, or empty array.Falsy and truthy comparators seem fucky in the beginning when coming from a strongly typed language. But they’re very convenient when used properly.
Monads exist, optional chaining has been around for ages, and implicit bool casts, too.
As you said, no one checks those values explicitly.