Random ramblings of a anonymous software engineer. Contains occasional profanity. Personal opinions, not related to employer.

Using JSC's Shell

All current versions of Mac OS X come with a nifty little JavaScript runtime that not many know about, called jsc.

Since it is not located in a convenient location for access, it's recommended to put it in a path for easier access.

ln -s /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc /usr/local/bin/jsc

Although it only handles standard ECMAScript (e.g. no console.log) it's useful for times when one does not want to install node.js for testing pure algorithm code. Simple scripts can be executed with

jsc filename.js

or simply invoking the command will drop you into a REPL context.