Possible Duplicate:
How can I check whether a variable is defined in JavaScript?
Say we have a piece of code like this. How would one be able to check whether the variable does exist or not in the case its value might be undefined?
var a = { foo: 'bar' }
a['foo'] = undefined;
// now a['foo'] returns undefined, as it does exist and contains undefined as its value
delete a['foo']
// now a['foo'] still returns undefined, but it doesn't exist
Thanks.