Installing an Interactive Javascript Shell

June 26, 2009

When you’re brainstorming some ideas for a program or learning a new language its great to have an interactive console to play with. It lets you start typing out code, inspect the return values, and experiment or debug in a really helpful way. You get immediate feedback on what each line of your code is doing. That’s why irb for ruby or script/console for your rails app are such great and useful tools. Once you get used to being able to dive into your application environment and fiddle around you wonder how you ever did without it.

There’s a cross-platform Javascript shell, which is super easy to get up and running. It uses Rhino which is an open-source implementation of JavaScript written entirely in Java.

I’ll show you how to install it on OS X in under 5 minutes.

Most of this should work on Linux (and maybe Windows) too with some minor tweaks.