javascript if exist code example
Example 1: javascript check if variable exists
if (typeof myVar !== 'undefined') {
// myVar is defined
}
Example 2: how to check if object exists in javascript
if (typeof maybeObject != "undefined") {
alert("GOT THERE");
}