Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging JavaScript REPL-style?

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?

like image 819
core Avatar asked Mar 16 '09 10:03

core


People also ask

Can you debug on REPL it?

There are 2 ways to use a REPL when debugging. Way 1: Open an empty REPL (like IPython, pry, or a browser Javascript console) to test out something. This is great but it's not what I'm talking about in this post. Way 2: Set a breakpoint in your program, and start a REPL at that breakpoint.

Does Replit have breakpoints?

Now you can start adding breakpoints to your repl: breakpoints are lines of the code where the program will be paused during execution while debugging.

Can you debug JavaScript?

But fortunately, all modern browsers have a built-in JavaScript debugger. Built-in debuggers can be turned on and off, forcing errors to be reported to the user. With a debugger, you can also set breakpoints (places where code execution can be stopped), and examine variables while the code is executing.


2 Answers

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

like image 68
Ivan Avatar answered Oct 05 '22 16:10

Ivan


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

like image 43
Hank Gay Avatar answered Oct 05 '22 18:10

Hank Gay