I have a function in a class
MyClass.prototype.IsFriend = function(){
return (this.m_Object1 && !this.m_Object1.m_ABoolean && this.m_Object2);
};
m_Object1
is an object in MyClass
.
m_ABoolean
is a boolean within m_Object1
, true
or false
.
m_Object2
is another object in MyClass
.
When this function should be returning false
when m_Object1
is null
OR m_ABoolean
is true
OR m_Object2
is null, it returns null
instead.
Note: m_Object1
, m_ABoolean
and m_Object2
are never undefined
.
Why?