Debugging JavaScript REPL-style?

Viewed 18686

Is there any sort of interactive debugger for JavaScript? I'm imagining something like a web page on the left, and a REPL interface on the right.

Or maybe even without having a web page, so I can just play around with the JavaScript language.

Something that doesn't require I refresh the web page with breakpoints in Firebug or VS to examine locals and type code into a Watch window. Maybe I just need to learn Firebug better?

JavaScript doesn't have to be compiled, after all.

Kind of like LinqPad but for JavaScript maybe?

Anyone follow me here?

20 Answers

To me, the most convenient debugger and REPL for JavaScript is Mozrepl. It is a Firefox/XULRunner extension that accesses the browser/application instance using telnet, and you can observe and manipulate everything in the browser; even the browser itself (remember, always talking about Firefox).

It is amazingly useful as a debugger (on standalone XUL applications it is the only bearable way to do real debugging) and as a tool to play around and understand the guts of your application, it speeds up your Javascript development time tenfold.

For an impressive demo of is possibilities, check out this video.

I've been using FireBug, i don't know if it is exactly what you need but i love debugging JavaScript through it.

Because you can print variables to its own console without having to always doing alert(var); you can just do console.log(var)

The Safari 4 beta has this ability in the error console (in the "Develop" menu). It's especially cool because when it returns an object or HTML node, it lets you delve into it with a little reveal arrow, showing its members, contents, etc.

A guide to using Firebug's command-line API is here: Link.

I usually use Chrome's built in console. Even recent versions of IE have a decent dev tools window.

JRunscript is super cool (and I'm embarrassed I didn't know about it), but the issues I usually run into are due to variations in javascript implementation or DOM, not the language itself.

Related