From Mozilla:
The value null is written with a literal: null. null is not an
identifier for a property of the global object, like undefined can be.
Instead, null expresses a lack of identification, indicating that a
variable points to no object. In APIs, null is often retrieved in a
place where an object can be expected but no object is relevant.
// foo does not exist. It is not defined and has never been initialized:
foo;
"ReferenceError: foo is not defined"
// foo is known to exist now but it has no type or value:
var foo = null;
foo;
"null"
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null
I believe that's how it behaves. If you have a look at the spec, it says:
7.2.12 Abstract Equality Comparison
The comparison x == y, where x and y are values, produces true or
false. Such a comparison is performed as follows:
If x is null and y is undefined, return true.
If x is undefined and y is null, return true.
Return false.
http://www.ecma-international.org/ecma-262/6.0/#sec-abstract-equality-comparison
So basically if you try something like:
undefined == null // this should return true.
But you cannot use a reference which you have not defined. In my opinion, a good test to see if the variable is defined is to do something like below.
typeof variable !== 'undefined'
Feel free to ask if you need further clarifications :)
window.fbq.var fbq = "";ReferenceError