admin管理员组文章数量:1134249
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?
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?
Share Improve this question edited Sep 4, 2015 at 17:47 Jadam 1,7551 gold badge21 silver badges41 bronze badges asked Mar 16, 2009 at 10:49 corecore 33k45 gold badges140 silver badges195 bronze badges 3- Old link, but since it comes up on Googe searches - JSFiddle.net is also a good option. – paulsm4 Commented Feb 11, 2015 at 20:55
- 1 repl.it is a good place. – Jerry Jeremiah Commented Jul 2, 2015 at 22:55
- Also, I jjust found babeljs.io/repl – Jerry Jeremiah Commented Jul 2, 2015 at 23:00
20 Answers
Reset to default 29Node.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
Stand-alone REPL (no browser/DOM, just JavaScript): JavaScript Shell from the Rhino project.
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.
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.
Google Chrome has a very nice built-in Javascript console with great debugging and performance analysis functionalities.
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.
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.
I use firebug console window for this.
i use JSFiddle online (http://jsfiddle.net/) or seed in a linux terminal (http://live.gnome.org/Seed)
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.
A guide to using Firebug's command-line API is here: Link.
Javascript REPL based on windows Script Host.
Also, there's a nice integration between that REPL and emacs.
repl.it supports REPL for number of languages, including JavaScript or you can try Codeacademy Labs it also has JavaScript REPL
LightTable lets you type in code and run it, and shows you the result inline.
Like this:
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
For Chrome You can use jsshell - nice console:
https://chrome.google.com/extensions/detail/kmgmkbicahmbceidoidjbkbpkfogaldh
http://hugoware.net/projects/jsshell
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.
Use osascript
on OS X
$ osascript -l JavaScript -i
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/
本文标签: Debugging JavaScript REPLstyleStack Overflow
版权声明:本文标题:Debugging JavaScript REPL-style? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736859056a1955835.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论