Debugging JavaScript REPL-style?

Solution 1:

Node.js has a REPL.

On Mac OS X:

brew install node
node

.exit to exit the repl, .help for other options

http://nodejs.org/docs/v0.3.1/api/repl.html

Solution 2:

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

Solution 3:

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.

Solution 4:

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.

Solution 5:

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