Make sure you read the relevant API docs.
Use Chrome’s developer tools, Firebug, or IE’s, and Visual Studio debugger, they are awesome.
Use console.log and alert in code when necessary when tracing code is difficult.
Run JS scripts from JS console.
Don’t be afraid to trace through third party’s frameworks and libraries when necessary.