3 ms·
This is nonsense. If typeof(x) is 'boolean', then x is either true or false. Now, if you don't know the type of x and try to use it as boolean without being ca
by moefh 9y ago
This is nonsense. If typeof(x) is 'boolean', then x is either true or false.
Now, if you don't know the type of x and try to use it as boolean without being careful, it might look like it has four values. That comes partly from being dynamically typed and partly from performing coercion instead of throwing errors. So one might argue that Javascript encourages people to write code that's not careful, or that it's very clumsy to write careful code in Javascript, but saying booleans have four values is just nonsense.
- catnaroek 9y agoIt's perfectly okay for a Boolean algebra to have four values. The two extra values can't behave the way JavaScript's “null” and “undefined” do, though. No three-valued Boolean algebra exists.