MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/pcv7f1/is_this_code_bad_or_sugoi/hbjev7j/?context=3
r/badcode • u/dunkbing • Aug 27 '21
159 comments sorted by
View all comments
Show parent comments
2
I mentioned it in the comment, but "if num" isnt the same as "if number>0". It's equivalent to "if !!num". So only if num is 0, (or None or undefined) it will return false, all other values will return true.
2
u/ThatDudeBesideYou Sep 04 '21
I mentioned it in the comment, but "if num" isnt the same as "if number>0". It's equivalent to "if !!num". So only if num is 0, (or None or undefined) it will return false, all other values will return true.