A reference in javascript can have one of four distinct states: undefined, null, scalar, or object. If you are familiar with Java you'll recognize null, and object. Scalar is essentially the same thing as a primitive in Java, so that only leaves undefined to be explained. Many languages like Java or C# will check references at compile time. This means that if the compiler encounters some reference that hasn't been defined elsewhere, it will throw an error. This forces the programmer to define all references before compilation will succeed. In Javascript and other interpreted languages there is no compile time checking of references. This occurs during runtime, which means that if you use an reference that wasn't defined somewhere you'll usually encounter a nasty error. This forces the programmer to check whether a reference has been defined in situations where it isn't guaranteed. This might happen if you conditionally include a library file and refer to objects in the library from your code. Just like we learn that null and empty string aren't the same thing when it comes to relational databases, it's important to learn that null and undefined are not the same thing in Javascript.
For instance, this Javascript snippet will fail with the error "abc is not defined":
if (abc != null) alert ("not null!");

Once we add a line defining abc, then we can refer to it:
var abc = null;
if (abc != null) alert ("not null!");

This code will run without error and the alert will not occur.
Assuming abc *might* be defined elsewhere, the way we protect our code against abc not being defined looks like this:
if (typeof(abc) != "undefined") {
alert("defined!");
if (abc != null) alert("not null!");
}

So if abc was never defined, this code prints nothing. If it's been defined but is null, you'll get one alert: "defined!" If it's been defined and isn't null, you'll see both alerts.
More compactly you can write:
if (typeof(abc) != "undefined" && abc != null) do something wth abc...

The typeof function is useful in Javascript when you aren't sure of the state of a reference. In addition to checking whether it's defined, you can use it to check whether a reference points to an object:
if (typeof(abc) == "object") abc.method();

This is useful if you're not sure whether abc is an object or a scalar. If you called abc.method() without this check and abc turned out to be a scalar you'll get this error: "abc is null or not an object."