First, there are two shells that run stand-alone, outside a web browser:
Rhino: Download, unzip, go into its directory and type “java -jar js.jar”. Editing is limited, but you can fix that.
- Better line editing: see section in “New in Rhino”.
- Help: help()
- Printing an object: use the .toSource() method to see an object’s properties.
- Rhino 1.7R2 does not support ECMAScript 5, yet. You need to check out and build the latest version.
- Check out: cvs -d :pserver:firstname.lastname@example.org:/cvsroot co mozilla/js/rhino
- Go into directory: cd mozilla/js/rhino/
- Display build options: ant help
- Build jar: ant jar
node.js: Download, build and install (as explained on the website). Type “node” to start. Its editing is quite capable, it even shows properties if you hit Tab after the dot in input such as “obj.”.
On Firefox, I’ve had good experiences with the Web Console
. Especially useful: Call console.dir(value)
from your code to explore a value in the console.