Client side web programming


Programming practices: Validation and debugging

Programming always starts with planning: there is a problem that needs to be solved. Analyse the problem and needs, then outline the processing logic (using flowcharts) by separating input, processing, and output. If the problem is large, devide it into modules.

Software testing is an essential part of programming. Test all solutions in all possible cases, also with faulty input or error situations. Firefox, Chrome and IE have Javascript debuggers. You may test the logic also on paper by tracing variable values step by step. One way of checking intermediate values is to add extra output (such as alert boxes) to the code.

Add commenting to all your code, so that each section is clearly separate and explained. Add your name or initials to all pages as well, or if you co-author, to the sections that you have created. When you copy code from other sources, indicate them clearly.

A Javascript reference is on the Mozilla pages.

You can trace problems in Firefox using debugger tools that are available from the Tools, Web developer menu: select Error Console for debugging Javascript. Keyboard shortcut is CRTL+SHIFT+J. Similarly with Chrome.
Note also the Responsive design option that lets you compare different screen sizes.
The shortcut for debugging in IE9 is F12.
In Chrome, keyboard shortcut is CRTL+SHIFT+J. You can also right-click on a page to get the Inspect element -option.

Javascript validators:

Validation for forms: form validation.

HTML validator is located on


Created by: Jaana Holvikivi
Last update: 16.1.2013