javascript check if variable exists

JavaScript
if (typeof myVar !== 'undefined') {
    // myVar is defined
}
Source

Also in JavaScript: