Unfortunately, JavaScript does not require you to explicitly put in semi-colons everywhere that there should be one - but it will internally put those in for you. This can often lead to hard to trace bugs and unexpected behavior.
Unfortunately, JavaScript does not require you to explicitly put in semi-colons everywhere that there should be one - but it will internally put those in for you. This can often lead to hard to trace bugs and unexpected behavior. Among other syntax errors in your code (as others have pointed out), the ; after the while in a do-while is required and when you put in there, things work as you expect them to.
When this isn't done, it's pretty much impossible for the casual developer to predict how different environments will behave without digging deep into the specs of the language and the JS engine and understanding it all - assuming there are no bugs in the implementation of the JS engine itself. Little things such as whether you have braces ( { and } ) in the same line or not can make a difference.
2 to expand on NGAC's great answer, this is why jslint.com was invented. (not that I agree with all the decisions jslint makes - in fact, in its most recent incarnation it's useless due to incredible pickiness about where var appears! ) – Dan Davies Brackett Mar 22 at 20:38 3 @DDaviesBrackett others feel the same way about jslint, and have made an alternative: jshint.Com – Zikes Mar 22 at 20:55 The worst part about trying to debug this issue was that the actual js file is a minified file that has over 40,000 characters on one line.
I had to run it through the javascript beautifier (jsbeautifier. Org) so I could read the thing. I also ran it through jslint and it reported many violations, mostly about missing curly braces and semi-colons, but the original file is part of a package we bought so I don't want to make too many changes to it.
It just seemed strange that a missing semi-colon in one function would cause IE to complain that it couldn't find the other function. – Craig W. Mar 22 at 20:58 @no.good.at.
Coding - Regarding: "...it's really pretty much impossible to predict how different environments will behave. " That might be true, but the spec does set forth very specific rules that browsers should be following. – lwburk Mar 22 at 20:59 1 @Craig W - I'm guessing that insertion of a semi-colon where JS thought it was required caused some block of code to become unreachable.
Unlike in Java or other languages you might be used to, you can easily add a return and make some code unreachable or have functions nested within other functions among other things that can cause code that looks just fine to you to be interpreted very differently by the machine. – no.good.at. Coding Mar 22 at 21:28.
From my reading of the ECMAScript spec, IE's behavior is correct. See sections: 7.9.1 Rules of Automatic Semicolon Insertion (which describes the cases in which a semi-colon may be inserted, none of which apply) 12.6.1 The do-while Statement (which shows that your code is not a valid production of the form do Statement while ( Expression ).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.