Page is a not externally linkable
rewboss - 7:22 am on Jun 28, 2002 (gmt 0)
desc="And she said to me " and thinks: "Hmm, no operators, so that must be the end of the statement. Now, where's the newline? Or the semicolon? Darn, it's missing!" For relatively simple scripts, Netscape 4 is also useful. If the script doesn't run correctly, or at all, type javascript: into the address field. This will open a JavaScript console and show any JavaScript errors it has encountered during the current session. About semicolons: No, in JavaScript, it is not bad practice to leave them out. JavaScript was specifically designed for an environment where potentially every single byte may count, so JavaScript statements are terminated either by a semicolon or a newline. This is different from Java or C, which are compiled languages, and where the source code is designed to be human-readable (more or less). So comments in Java (for example) make no difference to the size of the compiled file, and Java source code is expected to be well-commented for ease of maintenance. In JavaScript, comments merely add bloat, so should be removed before releasing the script. For long JavaScripts, I actually recommend removing not just comments, but unnecessary whitespace and, yes, semicolons. I've found you can make the file anything up to 50% smaller. I think of it as analogous to compiling a Java application: it's more important for it to be machine-readable than human-readable. I keep a human-readable version on file. (Although, if I find my scripts getting that long, I might decide to switch to a client-side script instead.)
Missing ; means: "I think you meant to start a new statement here, but you don't have a linebreak or a semi-colon." The parser doesn't always guess correctly, though. It sees: