js isset variable code example
Example 1: javascript isset
if (typeof foo !== 'undefined') {
}
Example 2: isset js
if (typeof obj.foo !== 'undefined') {
}
Example 3: check if isset variable js
var status = 'Variable exists'
try {
myVar
} catch (ReferenceError) {
status = 'Variable does not exist'
}
console.log(status)