@[email protected] to politics @lemmy.world • 2 years agoTexas Governor Greg Abbott declares that Texas law supercedes Federal authority and hints at secessionboingboing.netexternal-linkmessage-square326arrow-up1809
arrow-up1786external-linkTexas Governor Greg Abbott declares that Texas law supercedes Federal authority and hints at secessionboingboing.net@[email protected] to politics @lemmy.world • 2 years agomessage-square326
minus-squareTimeSquirrellinkfedilink18•edit-22 years agoNormal languages: “does this equal that?” JS: “does this REALLY equal that, or just ‘equal’ that?”
minus-square@[email protected]linkfedilink10•2 years agoJS comparing a string and some random number: “ah, close enough probably”
minus-square@[email protected]linkfedilink-2•2 years agoBeats having explicit null checks everywhere.
minus-square@[email protected]linkfedilink3•2 years 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-square@[email protected]linkfedilink1•2 years agoMonads exist, optional chaining has been around for ages, and implicit bool casts, too. As you said, no one checks those values explicitly.
Normal languages: “does this equal that?”
JS: “does this REALLY equal that, or just ‘equal’ that?”
JS comparing a string and some random number: “ah, close enough probably”
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.
Monads exist, optional chaining has been around for ages, and implicit bool casts, too.
As you said, no one checks those values explicitly.