Search code examples
debuggingerror-handlingprototypejs

How do you handle debugging when using Prototype.js


In a lot of cases when my prototype.js javascript code hits an error, I don't get any error notification, line number, etc. I usually end up tracing through my code with alert statement until I find where it dies. Is there a better way to track down these errors?


Solution

  • Depends on browser, but there are some very good ways of handling errors. If you are using firefox, you can install FireBug and then use:

    console.log('like an alert but in the firebug window');
    

    It's alot quicker than pressing ok, then ok, then ok...

    http://getfirebug.com/

    Firebug also has an amazing JS error debugger, and gives great feedback as to what is wrong with your code. A must have if you ask me!