return2ozma@lemmy.world to politics @lemmy.world · 10 months agoTexas Governor Greg Abbott declares that Texas law supercedes Federal authority and hints at secessionboingboing.netexternal-linkmessage-square290fedilinkarrow-up1703arrow-down120
arrow-up1683arrow-down1external-linkTexas Governor Greg Abbott declares that Texas law supercedes Federal authority and hints at secessionboingboing.netreturn2ozma@lemmy.world to politics @lemmy.world · 10 months agomessage-square290fedilink
minus-squareTimeSquirrel@kbin.sociallinkfedilinkarrow-up16·edit-210 months agoNormal languages: “does this equal that?” JS: “does this REALLY equal that, or just ‘equal’ that?”
minus-squareWrench@lemmy.worldlinkfedilinkarrow-up2arrow-down4·10 months agoBeats having explicit null checks everywhere.
minus-squareRandelung@lemmy.worldlinkfedilinkarrow-up3·10 months agoAs opposed to null and undefined?
minus-squareWrench@lemmy.worldlinkfedilinkarrow-up3·10 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.
Normal languages: “does this equal that?”
JS: “does this REALLY equal that, or just ‘equal’ that?”
Beats having explicit null checks everywhere.
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.