check if the object exists in var code example Example: javascript check if variable exists if (typeof myVar !== 'undefined') { // myVar is defined }