views:

1155

answers:

9

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. For example, see this for Ruby: http://tryruby.hobix.com/.

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?

+3  A: 

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.

Jesse Rusak
+2  A: 

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)

Ólafur Waage
+2  A: 

I use firebug console window for this.

Eugene Morozov
+1  A: 

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

alxp
+3  A: 

Stand-alone REPL (no browser/DOM, just JavaScript): JavaScript Shell from the Rhino project.

Hank Gay
+3  A: 

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.

Sergi
+3  A: 

eloquent javascript's console at the bottom of the page seems to what you are looking for. Just click on the console label and a sliding console will emerge.

To allow you to try out programs, both the examples and the code you write yourself, this book makes use of something called a console. If you are using a modern graphical browser (Internet Explorer version 6 or higher, Firefox 1.5 or higher, Opera 9 or higher, Safari 3 or higher), the pages in this book will show a bar at the bottom of your screen. You can open the console by clicking on the little arrow on the far right of this bar.

Comptrol
+2  A: 

Just to provide another option, check out the shell bookmarklet here. I've been using it for years to run JavaScript against the currently loaded webpage.

The Firebug console is probably a little more feature-rich so I'm not sure there's any compelling reason to use this instead, but it may be a useful tool in some rare cases.

devewm
A: 

Google Chrome has a very nice built-in Javascript console with great debugging and performance analysis functionalities.

Mtgred