jroid8@lemmy.world to Programmer Humor@lemmy.ml · před 1 rokemknow the features of your languagelemmy.worldimagemessage-square144fedilinkarrow-up1642arrow-down124
arrow-up1618arrow-down1imageknow the features of your languagelemmy.worldjroid8@lemmy.world to Programmer Humor@lemmy.ml · před 1 rokemmessage-square144fedilink
minus-square𝕱𝖎𝖗𝖊𝖜𝖎𝖙𝖈𝖍@lemmy.worldlinkfedilinkarrow-up7arrow-down1·před 1 rokemTypescript/Javascript too
minus-squareFooBarrington@lemmy.worldlinkfedilinkarrow-up17·edit-2před 1 rokemNot strictly equivalent, since || tests for truthiness, not just null.
minus-square𝕱𝖎𝖗𝖊𝖜𝖎𝖙𝖈𝖍@lemmy.worldlinkfedilinkarrow-up1arrow-down2·před 1 rokemThat’s fair, but it’s close enough that it functions identically
minus-squareFooBarrington@lemmy.worldlinkfedilinkarrow-up4·před 1 rokemOnly 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
.