When developing Javascript, you may wish to run code outside the browser. Luckily OS X comes with a world-class Javascript engine, which features a command-line interpreter.

Since it's hidden deep inside a framework, create a symbolic link:

sudo ln -s /System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc /usr/local/bin/js

Now, you can enter the interpreter by simply typing:

js

The interpreter can be quit by typing quit(); or ctrl+c.