JavaScript -Emission
if (typeof foo !== 'undefined') {
}
Grepper
if (typeof foo !== 'undefined') {
}
if (typeof obj.foo !== 'undefined') {
}
if (typeof obj.foo !== 'undefined') {
// your code here
}
var status = 'Variable exists'
try {
myVar
} catch (ReferenceError) {
status = 'Variable does not exist'
}
console.log(status)
if (obj.hasOwnProperty('foo')) {
// your code here
}