tfm@europe.pub to Programmer Humor@programming.devEnglish · 1 day agoTrue crimeeurope.pubimagemessage-square54fedilinkarrow-up1292arrow-down111
arrow-up1281arrow-down1imageTrue crimeeurope.pubtfm@europe.pub to Programmer Humor@programming.devEnglish · 1 day agomessage-square54fedilink
minus-squarefoxglove (she/her)@lazysoci.allinkfedilinkEnglisharrow-up15·1 day agoif it’s 'FILE_NOT_FOUND' then the string will be read as truthy and you will get 'User is admin' logged.
minus-squareBjörn Tantau@swg-empire.delinkfedilinkarrow-up29·1 day agoAckshually three equal signs check for type as well. So mere truthiness is not enough. It has to be exactly true. Also, everyone knows FILE_NOT_FOUND isn’t a string but a boolean value.
minus-squarefoxglove (she/her)@lazysoci.allinkfedilinkEnglisharrow-up1·5 hours agoyeah, it’s funny how my brain collapsed the boolean check into if (role) rather than if (role === true) - that’s tricky what is FILE_NOT_FOUND? I can’t find much on it …
minus-squareBjörn Tantau@swg-empire.delinkfedilinkarrow-up2·5 hours agoFILE_NOT_FOUND is from an old story on thedailywtf.com. Someone created a boolean enum with TRUE, FALSE and FILE_NOT_FOUND, if I recall correctly. It’s been a recurring running joke.
if it’s
'FILE_NOT_FOUND'
then the string will be read as truthy and you will get'User is admin'
logged.Ackshually three equal signs check for type as well. So mere truthiness is not enough. It has to be exactly true.
Also, everyone knows FILE_NOT_FOUND isn’t a string but a boolean value.
yeah, it’s funny how my brain collapsed the boolean check into
if (role)
rather thanif (role === true)
- that’s trickywhat is
FILE_NOT_FOUND
? I can’t find much on it …FILE_NOT_FOUND is from an old story on thedailywtf.com. Someone created a boolean enum with TRUE, FALSE and FILE_NOT_FOUND, if I recall correctly. It’s been a recurring running joke.