4 ms·
The result of "foo == null" (or better "foo === null") is boolean, I don't know what is the "equivalence" problem here.
by wreegab 13y ago
The result of "foo == null" (or better "foo === null") is boolean, I don't know what is the "equivalence" problem here.
- sixothree 13y agoMaybe this is a programmer who likes to spell things out for future readers. It's easier to convey meaning with return foo == null ? true : false;
- wreegab 13y agoLet's picture a future reader: "Hmmm, if 'foo == null' is true, than it's true... I see..." Seriously..
- jebblue 13y agoFrom a maintenance perspective, it's a bit more involved than that. Returning the explicit evaluation result says, "I do care what foo is and these are the only valid possible return values after expression evaluation, today just return null but in the future we might return something different, either way the return value at this point is critical and needs to be explicitly considered and processed".
- sixothree 13y agoYeah, it was a wild guess. I have a habit of making things more verbose for future maintainers.
- EpicEng 13y agoTo a non programmer or an absolute beginner? Sure, but then I would ask; why in the hell are you writing your code in a style catered to people who don't know what they are doing? That line simply shows that the writer doesn't understand Boolean expressions.