Helping ordinary people create extraordinary websites!
GET OUR NEWSLETTER
Your Email:
 

JavaScript Debugging Techniques with Firebug

By Akash Mehta
2008-04-20


Understanding JavaScript errors

When working with JavaScript, there are three main types of errors you will encounter:

  • Syntax errors
  • Runtime errors
  • Logic errors

Syntax errors refer to simple errors in code - for example, missing a parenthesis in an if statement for if variable==value) - which will trigger an error in the JavaScript interpreter.

Runtime errors are those that are valid JavaScript code, but fail for some reason based on the context or what they do. These include, for example, referring to a variable that does not exist or is not visible within the current scope, or working with one data type as if it is another.

Finally, logic errors, the hardest to identify, refer to mistakes in the code - for example, making a particular comparison when you actually want to be making another. These are most commonly found in the complaint "my code does one thing when it should do another entirely". If you find yourself in this situation, you probably have a logic error. Advanced debugging techniques make identifying logic errors very easy.



Tutorial Pages:
» Understanding JavaScript errors
» General debugging
» JavaScript debugging tools
» Debugging syntax errors
» Debugging runtime errors
» Debugging logic errors
» Further reading


Related Tutorials:
» Striped Tables Using JavaScript
» Opening PDFs in a New Window with JavaScript
» Essential Javascript -- A Javascript Tutorial
» Submit Forms Conditionally using JavaScript
» How to Setup a Randomising Function
» Introduction to JavaScript Tutorial

Advertise with Us!


Tutorials Scripts Web Hosting Developer Manuals
Resources