That is extremely useful. Do you know if any testing libraries or other useful functionality have been built around this?
I suppose if you are a WebKit-only developer, this utility could have many useful applications.
There's also mozrepl, which lets you evaluate code in Firefox from the command-line or Emacs.
Re:Wat
by hchinchilla on Thursday January 26, 2012 @06:52PM
(#3516537)
Thanks, I'll look how to get this working on linux.
At least Arch has `js`package which gives you js command to obtain JS shell; in fact it is just Mozilla's SpiderMonkey. Anyway, the best option for "standalone JS" is node, mainly because it has a sane way of importing code from other files.
Alternatively, you could use Rhino Shell (https://developer.mozilla.org/en/Rhino_Shell) - it even supports tab completion!
/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc
You can just do:
sudo ln /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc /bin/jsc
To be able to invoke it directly from the command line.