< Browse > Home / PHP/MySQL & JavaScript, XHTML & Coding / Blog article: Proofreading JavaScript

| Mobile | RSS

Proofreading JavaScript

March 11th, 2005 | 4 Comments | Posted in PHP/MySQL & JavaScript, XHTML & Coding

It is very important to get into the habit of proofreading your HTML code. Here are a few tips for proofreading. Thank you to Dale Mead for his additional suggestions on proofing.

  1. Proofread, proofread, proofread. Then proofread more.
  2. JavaScript is case sensitive, MyVar is different from myvar
  3. Make sure that all variables are named the same throughout the entire script
  4. Do not put a line break in the middle of a document.write statement (ie, don’t press the enter key in the middle of the line so that your code matches the book)
  5. { are used in pairs, you shouldn’t have an odd number of { in your code. Quotations marks " and single quotation marks ‘ are also used in pairs.
  6. When quotations are used, such as around tag attribute values they should be used in pairs. Make sure that you have an even number of quotes in your code. There should usually be a space after a quotation mark.
  7. HTML, Cascading Style Sheets and JavaScript all commonly use punctuation in pairs. A very handy way to minimize omitting one of a pair is to first create the pair, then go back between them to add content. For example, write width="", and then go back and put in the ontent:
    width="50%". This works for "", <>, (), [], {}, and even <!– –>.
  8. Make sure that spaces are used appropriately. Make sure that there is a space after a quotation mark, a space between an <a href> tag,
  9. Check to be sure that correct casing has been used. Generally, this means using only lower case for all HTML tags and attributes. Use upper case or upper-and-lower case only in content or values that your site visitor will see, to comply with standard English usage.
  10. Make sure that all tags are closed. You can take the pairs practice (tip #2) one step further to close tags: Create the tag (e.g. <table>), then the closing tag (e.g., </table>), and then back up between them to add content. This significantly reduces omissions.
  11. If you can’t find an error in your code on the computer monitor, print the code and proofread it again. Place a straight-edge under each line of code to proofread it more accurately.
  12. Use an HTML validator to help find mistakes in code. Open your page in Dreamweaver. Dreamweaver will highlight some HTML code errors.
  13. Don’t forget: Internet Explorer serves as an JavaScript validator when you preview your page out of TextPad. If it picks up an error, it puts a yellow Alert triangle at the bottom left corner of the preview window; double-click on it to get a clue. When you read the IE alert, also note if the Previous button is active; if so, click on it to see a previous error that might be causing the initially revealed error.
  14. Be sure to test your pages on several different browsers.
  15. Have a friend proofread your code and content.
  16. Take a break. It’s easy to miss errors when you have been reading something for too long.
  17. Use a spell checker.
  18. Read your content out loud.
  19. If you receive a JavaScript error in the classroom that includes a link to another web site the site may be blocked by our firewall and this would cause a script error. This error may only appear in our classroom and not on other systems.

Helpful sites for debugging JavaScript:

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • StumbleUpon
  • Design Float
  • Reddit
  • Twitter
Leave a Reply 2059 views, 1 so far today |
Follow Discussion

4 Responses to “Proofreading JavaScript”

  1. David Hucklesby Says:

    Great tips, Robin. I employ #16 often. ;-)

    Although Mozilla and Firefox have a powerful Javascript debugger, I find it overkill for the class assignments. Instead, I find Opera’s Javascript console has, for me, error messages that are easiest to understand. It also has some other neat features that simplify debugging.

    More details and ideas here:

Trackbacks

  1. Take My Advice - I’m Not Using It! » Blog Archive » Important Notes for Students Starting the XHTML Book  
  2. Robin’s Blog - Resources for the Aspiring Web Developer » Important Notes for Students Starting the XHTML Book  
  3. Lorelle on WordPress » Proofreading Your Content and Code  
BubbleRelaxPlasmaBubbleDripPlaying with Water and LightPlaying with Water and LightPlaying with Water and LightPlaying with Water and LightPlaying with Water and LightwetJust Posing