this post was submitted on 14 Aug 2025
281 points (96.4% liked)
Programmer Humor
25705 readers
1290 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
What if
role
isFILE_NOT_FOUND
?!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.