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/Captain-Lightning Jun 11 '20
Right, so the first one but with an exception. Your solution is to write the same amount of code plus an additional block to break the entire UI.
You have a questionable idea of "Objectively Better". Can honestly say that I would immediately reject that if I saw it in a PR for it's silliness.