3 ms·
If the value is expected to be a Boolean, use undefined to set it as undefined. For everything else, use false to “explicitly assign it”, you don’t need a thir
by anuila 6y ago
If the value is expected to be a Boolean, use undefined to set it as undefined.
For everything else, use false to “explicitly assign it”, you don’t need a third type.
- JimDabell 6y ago> use false to “explicitly assign it” Then you still have null, you’re just spelling it funny while confusing all the other developers who have to deal with your code and making it incompatible with language constructs like the nullish coalescing operator. If the concept you are trying to express is “null”, then please use null to represent that instead of bringing in a poor substitute like an overloaded false.
- anuila 6y agoNo, most likely I'll just use undefined because my abstractions are not a complicated mess that need 2 null types. Found? string Not found? undefined
- JimDabell 6y ago> most likely I'll just use undefined You were telling people to use false and that’s what I was responding to. That’s why I quoted that part in my comment.