Thursday, September 6, 2007

Discovery: Javascript Variables Need Declaring

I've been working on this iPhone App... which had been rolling along nicely.

Then... after adding a few lines of code, it stopped working (what I had gotten done so far anyway).

Narrowed it down to this line:

sCurrPanelCode = sID;

"Weird!" I thought. So I used a try/catch on this line with a message box.

The message returned: "Can't find variable: sID"

I would have assumed if I hadn't declared it it would have created it automatically and returned "NaN".

Nope! Just keep a weather eye out for this one mates!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.