Given that in JavaScript
console.log("var F=new Boolean(false)")
console.log("( F != (F==false))",(( F != (F==false)) ? "TRUE" : "false"));
console.log("(!F != (F==false))",((!F != (F==false)) ? "TRUE" : "false"));
prints:
( F != (F==false)) TRUE
(!F != (F==false)) TRUE
which means that Boolean objects are not dop-in substitutes for a boolean primitive in typical conditions like:
if(someBoolean) ... // always true
if(!someBoolean) ... // always false
And that JavaScript's Set
and Map
collections permit any type, including primitives.
What use are Boolean objects, in particular; and the objects representing other primitive types in general, since they have all sort of weird in consistencies associated with them?
Note: I am specifically asking what are the use-cases (if any), not how they are different from their primitive counterparts.