I remember a condition that caused me change my approach of checking for undefined variable. It does go back to the reason on my prior post.
When
I was working
on some widgets, I was trying check if a sharepoint variable was already set. That variable was set globally by one of the sharepoint js files, and I found that if I checked it before it was defined, it would throw the exception.Did a quick check in firebug
and confirmed this
: If (myinvalidvar === undefined) { console.log("yes"); }
Throws error.
Again, in this specific case, its not an issue: you are defining (initializing) the listName variable, so it will not give you the ReferenceError.
:)
:)