Anyway.. back to topic, so ....
null means lack of value and when you see null it can indicate that something does not contain a valid string, number, boolean , array or ... object.
For example compare null to undefined ,why ??
Let's explain what undefined means:
Undefined appear when
- Something wasn't declared and you try to call this. (like Object)
- Variable has been declared but never had a value assigned
- property of Object which you refer to doesn't exist.
In string context to null
In number context you will see NaN (which means Not A Number) (why ? this is another story which will explain in one of future posts)
In boolean context to false
Few interesting things on end of this post:
- null is related as lack of variable of something that exist
- undefined means that something doesn't exist.
And last .... people who are very sensitive in speaking/writing correctly always get mad because they said that "do not say/write null value .. say/write null ... why ? because null means lack of value)
So if you have no f... idea why result of your comparison is weird ambiguous unexpected or not logical .. look to this post again. It can save your nervous system!