Because of low-bandwidth loading problems, a variable may be declared but not yet set to a "new" instance of a Constructor Function's object. In such a limbo state the variable will be null. As a precaution, test for null. For example,
if (objAgent != null) {
if (objAgent.cool) { //do stuff }
}
checks for the instantiation of objAgent before its "cool" property is tested. This often happens while a page is loading and the page has an OnLoad event that binds one or more variables to an object. (Recall that the OnLoad event does not fire until all elements on the page are completely loaded.) If an element on the loading page refers to an object that is not yet instantiated (because the OnLoad event has not fired yet) and no precautions are taken, a "not an object" error will occur.