Stilltorik
Stilltorik

Reputation: 1692

Possible ways to detect where 'undefined' is being overwritten?

I currently have a bug in IE7 where undefined being overwritten causes the website to crash. It works fine on Firefox, Chrome and IE8+ (I'm guessing because those browsers don't allow undefined to be overwritten).

I'm trying to find where it is being done, to be able to protect my code. Unfortunately, it's not on my own code. I tried looking for "undefined=", "undefined =" and "['undefined']" in firebug, in the hope that I'd find which dependency is changing overwriting it, unsuccessfully.

I am stuck now, and I really don't know what else to try. Does anyone has an idea what I could do to find the line of code responsible for this?

Thanks in advance!

Upvotes: 3

Views: 92

Answers (1)

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324650

You should never be using undefined as if it were a value anyway. The correct way to test for undefined-ness is typeof somevar == "undefined"

Upvotes: 5

Related Questions