Debugging JavaScript REPL-style?

JavascriptDebugging

Javascript Problem Overview


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?

Javascript Solutions


Solution 1 - Javascript

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 - Javascript

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

Solution 3 - Javascript

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 - Javascript

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 - Javascript

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

Solution 6 - Javascript

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.

Solution 7 - Javascript

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)

Solution 8 - Javascript

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.

Solution 9 - Javascript

I use firebug console window for this.

Solution 10 - Javascript

i use JSFiddle online (http://jsfiddle.net/) or seed in a linux terminal (http://live.gnome.org/Seed)

Solution 11 - Javascript

If you're on a Mac, OSX includes jsc. Nothing new to install, just set up a link:

ln -s /System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Resources/jsc /usr/local/bin/jsc

Now you can start jsc from a terminal. Type quit() or CTRLC to get out.

Solution 12 - Javascript

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

Solution 13 - Javascript

Solution 14 - Javascript

repl.it supports REPL for number of languages, including JavaScript or you can try Codeacademy Labs it also has JavaScript REPL

Solution 15 - Javascript

LightTable lets you type in code and run it, and shows you the result inline.

Like this:

enter image description here

Solution 16 - Javascript

Mancy is an open sourced, cross platform JavaScript REPL application. Its based on electron and react frameworks.

Some neat features:

  • Syntax Highlighting
  • Dark and light themes
  • Import/Export command history
  • Separate console window for async stdout/stderr logs
  • Notification for async console logs
  • console output filter support
  • Traversable output with fold/unfold options
  • Support for adding directory to node path
  • Expand/Collapse/reload command options
  • History traversal support
  • Multiple window
  • Multiline prompt support with shift + enter
  • Auto suggestion
  • Tab completion
  • Code format support
  • Support to toggle REPL mode
  • Preferences for theme and REPL mode

enter image description here

Solution 17 - Javascript

Solution 18 - Javascript

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.

Solution 19 - Javascript

Use osascript on OS X

$ osascript -l JavaScript -i

Solution 20 - Javascript

Not exactly REPL but another options for playing around with different libraries in javascript is Google's API playground:

https://code.google.com/apis/ajax/playground/

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestioncoreView Question on Stackoverflow
Solution 1 - JavascriptIvanView Answer on Stackoverflow
Solution 2 - JavascriptHank GayView Answer on Stackoverflow
Solution 3 - JavascriptSergi MansillaView Answer on Stackoverflow
Solution 4 - JavascriptÖzgürView Answer on Stackoverflow
Solution 5 - JavascriptmtgredView Answer on Stackoverflow
Solution 6 - JavascriptdevewmView Answer on Stackoverflow
Solution 7 - JavascriptÓlafur WaageView Answer on Stackoverflow
Solution 8 - JavascriptJesse RusakView Answer on Stackoverflow
Solution 9 - JavascriptEugene MorozovView Answer on Stackoverflow
Solution 10 - JavascriptmwxView Answer on Stackoverflow
Solution 11 - JavascriptrymoView Answer on Stackoverflow
Solution 12 - JavascriptalxpView Answer on Stackoverflow
Solution 13 - JavascriptCheesoView Answer on Stackoverflow
Solution 14 - JavascriptVlad BezdenView Answer on Stackoverflow
Solution 15 - JavascriptRob GrantView Answer on Stackoverflow
Solution 16 - JavascriptPrince John WesleyView Answer on Stackoverflow
Solution 17 - JavascriptAndrej FinkView Answer on Stackoverflow
Solution 18 - JavascriptBrent RockwoodView Answer on Stackoverflow
Solution 19 - JavascriptCh0k0l8View Answer on Stackoverflow
Solution 20 - JavascriptMark LindellView Answer on Stackoverflow