location ) is a reference to a Location object; it represents the current URL of the document being displayed in that window. Since window object is at the top of the scope chain, so properties of the window. location object can be accessed without window.
null is not an object, it is a primitive value. For example, you cannot add properties to it. Sometimes people wrongly assume that it is an object, because typeof null returns “object” . But that is actually a bug (that might even be fixed in ECMAScript 6).
Use the strict inequality (! ==) operator to check if a variable is not null – myVar !== null . The strict inequality operator will return true if the variable is not equal to null and false otherwise.
To check for null variables, you can use a strict equality operator ( === ) to compare the variable with null . This is demonstrated below, where the boolean expression evaluates to true for only for null and evaluates to false for other falsy values.
Where is W3Schools located?
W3Schools offers courses covering all aspects of web development. It is run by Refsnes Data in Norway.