What's wrong with my Firefox and Chrome - in both browsers a simple test produces a result that is contrary to common sense and specifications:
[ true == null, false == null] /* false,false */
From the permutation of places the result does not change. Exactly the same picture with undefined
:
[ undefined == true, undefined == false, undefined == null] /* false,false,true */
If you create objects of type Boolean
, everything becomes as expected:
[ new Boolean(null) == true, new Boolean(null) == false] /* false,true */
Boolean(null)
it is created with a default value due to the lack of a value. This isFALSE
. It is better to checkNULL
separately. - SaidolimBoolean("")
andBoolean("1")
. - Pavel Mayorov