Hacker News new | past | comments | ask | show | jobs | submit login

For debugging client-side JavaScript, some things you can try for size in Firebug:

- Breakpoints in Firebug script debugger

- Find state of variables by assigning them to global vars temporarily, e.g.:

var debugState; // Delete me once you've finished debugging

function someFunction() { var state = 'interesting value I want to inspect'; .... do some work on 'state' debugState = state; }

Then access debugState in the Firebug console. The console allows you to use JavaScript to interact with your page.

- Using console.log(msg, ...) in your scripts. You can pass multiple variables and these will all get output to the console, e.g.:

console.log('The Carousel:', carousel, 'Foo:', bar, ...)




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: