Is it considered a bad practice to combine a loose equality check (foo != null) with a strict equality check (bar === true)?
In my opinion, they should both be compared with the strict equality, or both be compared with the loose equality check.
Is there ever a scenario where I would need to have a loose equality check combined with a strict equality check?
Thanks Stackoverflow!
Looking forward to your insight!
const foobar = foo != null && bar === true;
Edit, this question differs from Which equals operator (== vs ===) should be used in JavaScript comparisons? because, this is particularly on combining a loosely equal comparison with a strict equal comparison. This stack overflow question referenced above is only in conjunction with using one or the other.
I am particularly interested if its ever a valid use case to use both a loose equal, with a strict equal inside a comparison.