Programming Tips: Write cleanly

  1. Test Often
  2. Programming Tips
  3. Find a good text editor

JavaScript, as a programming language, is much less forgiving than HTML or even XHTML. Commands end with semi-colons. Upper and lower case are important. Curly brackets enclose blocks of JavaScript code. You can’t play around with those rules and expect to get a working script.

First, name your variables intelligently. Your variable names should describe what kind of data you expect the variable to contain.

You will notice that I “indent” parts of JavaScript code. Usually, anything inside of curly brackets gets indented by one tab more than the line just above it.

This indentation isn’t necessary. If you leave it out, your scripts will work just fine—if you don’t make any mistakes. Indenting makes it much easier to not make mistakes.

  1. Test Often
  2. Programming Tips
  3. Find a good text editor