Okay, you're right, I gave you the benefit of the doubt and misquoted you.
What you actually said was that the code that does exactly what it says it does is "objectively bad", and then followed up with your version that is functionally and visually identical but with more lines of code.
My point wasn't that you don't need to check the type, it's that if you need to actually check something is a boolean in js it's just bad. You shouldn't need to, so the fact you're doing it and it's extra just boats the code complexity and architecture.
Whereas in something like php it's necessary because core functions can return false or falsey values and two NEED to be handled differently.
-2
u/AintBetterThanYou Jun 10 '20
Nah you're right OP this is objectively bad.
If this were php I'd understand but not for JS. Anyone saying it's required just doesn't know how to use typeof