If we can't get things working, we need to go to our debugger. Most major browsers have their debuggers. The most popular for quite some time and, perhaps, the most evolved is FireBug (http://getfirebug.com/) a free debugger for the equally free Firefox browser (http://www.mozilla.com/) available for most operating systems. Internet Explorer has recently incorporated a debugger and Safari has had one for some time now.
Most of them are pretty intuitive and, anyway, each has its own documentation. We'll just mention a few things as they relate to the YUI Library.
JavaScript always tries to carry on in spite of errors. Sometimes an error that is not immediately fatal allows the interpreter to keep going until it really gets messed up and stops. At that point, the error is long past and hard to find. It is better to run all debuggers with the "break on all errors" (or however it might be called in each debugger) option on. This makes the interpreter stop at the first hint of an error...