If you go into the develop tools in any browser (other than Firefox which doesn’t have it unless you install the Venkman extension) you will find a full debugger there that is similar to that available in many other languages (and which you will therefore find much easier to work with than firebug - which is intended more for use with HTML and CSS and so works differently from the way a programmer would expect).