MacOS ships with a JavaScript shell jsc in the JavaScriptCore framework. The easy way to run it from Terminal is to link it into a standard directory:
ln -s /System/Library/Frameworks/JavaScriptCore.framework/Resources/jsc /usr/local/bin/jsc
What built-in JavaScript functions does jsc support?
The manual page documents some JavaScript functions like readline() and run(filename). But it's out of date — it's missing the command line options printed out by jsc --help.
I found the the source code to jsc. It sets up more JavaScript functions. Most of them look like testing and benchmarking hooks, but there some useful-looking functions like read and print. Are they documented anywhere?