I have a string like this:
var TheDate = "6.14.2012";
and I have an object MyObject that has properties that may match that string. However, when I write this:
if (MyObject[TheDate] === null || MyObject[TheDate] === 'undefined') { .... }
the conditions never seem to evaluate to true even though I know the property doesn’t exist.
What am I missing??
Thanks.
The problem is with the quotes around undefined 😉
Change
if (MyObject[TheDate] === null || MyObject[TheDate] === 'undefined') { .... }to
if (MyObject[TheDate] === null || MyObject[TheDate] === undefined) { .... }It should work 🙂