3.3 Bugs to Watch For


Try to declare all your variables at the beginning of the program, even if you don't have values for them yet. This will help you find misspelled names faster. Watch that you use proper variable names. Don't used reserved words and words that are too long to remember or type easily. Remember that variable names are case sensitive. MyName is not the same as myName . Avoid giving two variables similar names, such as MyName and myNames . Avoid one-character differences in variable names, such as Name1 and Names1 . Even though you aren't always required to use the var keyword, do it anyway. It's safer. And, of course, be sure that the variables you use are spelled properly throughout the script.

When you use strings don't forget to enclose the strings in either double or single quotes. Quoting will get the best of programmers every time!



JavaScript by Example
JavaScript by Example (2nd Edition)
ISBN: 0137054890
EAN: 2147483647
Year: 2003
Pages: 150
Authors: Ellie Quigley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net