JavaScript-Equality-Table icon indicating copy to clipboard operation
JavaScript-Equality-Table copied to clipboard

Add Boolean object to the table

Open bananpermobil opened this issue 10 years ago • 1 comments

The Boolean object seem to get cast when using == but not when using ===.

ex. new Boolean(true) == true // -> true new Boolean(true) === true // -> false new Boolean(false) == false // -> true new Boolean(false) === false // -> false

bananpermobil avatar Jul 07 '15 11:07 bananpermobil

I think this can be explained with the following sentence from the Mozilla Javascript Reference Do not confuse the primitive Boolean values true and false with the true and false values of the Boolean object.

new Boolean(true) has a value of true but it's not the same value as the primitive boolean value true

Therefore, it's not strictly equal

Errorname avatar May 07 '18 13:05 Errorname