how to check if object exists in javascript

JavaScript
if (typeof maybeObject != "undefined") {
   alert("GOT THERE");
}
Source

Also in JavaScript: