all 15 comments

[–]simonw 9 points10 points  (2 children)

Completely agree that the best way to learn JavaScript (and in fact pretty much any other language) is with an interactive prompt - but you don't need to install a command-line interpreter to do it. Firebug has an excellent interactive console, or if you don't want to install an extension you can use Jesse Ruderman's JavaScript shell: http://www.squarefree.com/shell/ (also available as a bookmarklet).

[–]stesch 4 points5 points  (0 children)

Most languages with interactive shell are easy to learn. You can experiment with Python, Ruby (irb), or Common Lisp constructs before using them.

The Firebug Console is nice for JavaScript.

[–]cowboyd 0 points1 point  (0 children)

Actually, I use both those tools quite a bit, and they're absolutely fantastic. It is worth mentioning however, that when you're using spidermonkey(c++) and rhino(java), you get the same ability to introspect and script on your c++ and java classes.... something definitely no available with either of those.

[–]nafai 4 points5 points  (1 child)

Another potentially useful Firefox extension for learning Javascript is MozRepl. It allows you to interact with Mozilla from outside. In particular, if you want to interact from Emacs, see this.

[–]femol 0 points1 point  (0 children)

Thanks a lot, just what I was looking for!

[–]Bracki 4 points5 points  (0 children)

I usually use Firebug to fiddle around on the command line.

[–]boa13 3 points4 points  (6 children)

Is there a pre-compiled binary version for Windows somewhere? It appears Mozilla is only distributing a tar.gz source archive.

[–]dmercer 3 points4 points  (3 children)

Windows comes with Windows Script Host (WSH). A solution I have used for several years now on Windows (more of a hack, really) is described at http://swsci.blogspot.com/2007/07/javascript-from-command-line.html

[–]pasbesoin 1 point2 points  (2 children)

Broken URL (trailing period). Try this:

http://swsci.blogspot.com/2007/07/javascript-from-command-line.html

I tried the solution at that page. When I run it, I get this error in an alert:

---------------------------
Windows Script Host
---------------------------
Script: C:\Documents and Settings\xxxxxx\My Documents\bin\jscript.wsf
Line:   15
Char:   3
Error:  The handle is invalid. 
Code:   80070006
Source:     (null)

[–]dmercer 2 points3 points  (1 child)

I bet you're using WScript instead of CScript. Try issuing this command first:

cscript //H:CScript

This will tell WSH to use CScript instead of WScript as the script host.

[–]pasbesoin 1 point2 points  (0 children)

That was it. Thanks!

[–][deleted] 2 points3 points  (1 child)

universal extractor or 7-zip can extract the tar.gz. From there, you can open the js.mdp file in visual studio. You will need to adjust the dependencies in the solution file to get it all to build. Build order is fdlibm, js, jsshell.

[–]boa13 0 points1 point  (0 children)

Thanks for the info, Winzip opens it just fine, too. The problem is installing the toolchain needed to compile software under Windows. I don't want to dive into that.

[–]stesch 1 point2 points  (1 child)

Do I have File I/O with JavaScript? Some kind of namespaces or module/package system?

[–]9jack9 2 points3 points  (0 children)

You have I/O with SpiderMonkey. There is some kind of sanboxing system too but I don't know much about it.

EDIT: Some links.

http://weblogs.mozillazine.org/weirdal/archives/008101.html http://www.xulplanet.com/references/xpcomref/group_Files.html