Home > Uncategorized > IRB for Javascript

IRB for Javascript

When doing some heavy exploration in Javascript, I was doing most of my trials in Firebug. This is tedious for because the cycle of making code changes in a text editor, then reloading Firefox, then finally stepping through to my new code is too long if you’re doing small changes repeatedly and rapidly.

Ruby comes with an interactive command line console that lets you play with code interactively without any of the overhead of writing code. There’s no text editor, no saving files, no loading programs. You can execute and inspect each line of code as soon as you can type it. It’s a wonderful way to explore.

Other prominent interpreted languages Python and PHP both also have interactive modes, so I checked to see if there is one for Javascript. And indeed there is! It turns out that you can just install Spidermonkey, which is the Javascript engine of the Mozilla project, ie Firefox. That’s pretty much the canonical version of Javascript, as far as I’m concerned. I mean, Netscape invented Javascript, and this code is presumably a descendant of Netscape’s. The Ubuntu repositories include the Spidermonkey engine as a standalone command line tool, without the web browser as a dependency. It’s exactly what I was looking for. Nice.

I wonder whether I can find a binary to install on my Mac too. Or whether webkit has something similar.

  1. No comments yet.
  1. No trackbacks yet.