jroid8@lemmy.world to Programmer Humor · 1 年前know the features of your languagelemmy.worldimagemessage-square147fedilinkarrow-up1650arrow-down124
arrow-up1626arrow-down1imageknow the features of your languagelemmy.worldjroid8@lemmy.world to Programmer Humor · 1 年前message-square147fedilink
minus-squareFooBarrington@lemmy.worldlinkfedilinkarrow-up17·edit-21 年前Not strictly equivalent, since || tests for truthiness, not just null.
minus-square𝕱𝖎𝖗𝖊𝖜𝖎𝖙𝖈𝖍@lemmy.worldlinkfedilinkarrow-up1arrow-down2·1 年前That’s fair, but it’s close enough that it functions identically
minus-squareFooBarrington@lemmy.worldlinkfedilinkarrow-up4·1 年前Only for the null case. For other cases it doesn’t function identically, since it also treats "", 0 and undefined the same as null.
Typescript/Javascript too
Not strictly equivalent, since
||
tests for truthiness, not just null.That’s fair, but it’s close enough that it functions identically
Only for the
null
case. For other cases it doesn’t function identically, since it also treats""
,0
andundefined
the same asnull
.