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 an开发者_如何学编程y 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?
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!
I already use Firebug ...
Is this case, try Chrome — I find that Firefox fails to notify me of errors in my code that uses Prototype.js, but Chrome is fine. Not that I'm a huge fan of Google over Mozilla.
精彩评论