gliptak
gliptak

Reputation: 3670

looking for a shell for Javascript coding/experimenting using command line

Is there a shell for Javascript coding/experimenting using command line offering history, completion, help, debug, etc.? I found iPython very useful for quick Python scripting.

I looked at various shells like node, Rhino, JSDB, but their command line functionality seem to be somewhat limited.

Upvotes: 4

Views: 301

Answers (2)

Cheeso
Cheeso

Reputation: 192467

I use kobyk's REPL on cscript.exe.

Also, I use emacs, and there is an elisp module that allows hosting of that REPL in emacs, called jsshell. This means you can do cut/paste, search/replace, command-line editing, and so on - all the text manipulation made available to emacs buffers is available in the interactive Javascript shell.

Welcome to the JScript shell.
Running JScript Version 5.8.16982
'exit' to exit.

js> 
loading c:\dev\js\json2.js
js> 

loading c:\dev\js\stringExtensions.js
js> 

loading c:\dev\js\moment.js
js> 

loading c:\dev\js\arrayExtensions.js
js> 
Multi-line input. Use two consecutive blank lines to eval.

var id = "11111;22222;33333"; 

id = id.split(";"); 

js> function say (x) {WScript.echo(x);}
js> for (var i in id) { say (i); } 
0
1
2
forEach
every
map
filter
remove
removeAt
indexOf
contains
js> for(var i=0;i<id.length;i++) { say (i + ": " + id[i]); } 
0: 11111
1: 22222
2: 33333
js> 

Upvotes: 0

robbrit
robbrit

Reputation: 17960

The Firebug console does exactly what you want, as does the Chrome Developer Tools (accessible by pressing F12 or by navigating through the menu).

Upvotes: 3

Related Questions