I get quite frustrated running JS by pasting into Chrome/FF and sometimes I like to keep everything local. These are some notes on using Apple's built in intrerpreter, node or phantom.
sudo ln -s /System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc /usr/bin
jsc
Create a file and save it. Change to the saved directory and execute the file:
jsc hello.js
brew update && brew install node
node
Create a file and save it. Change to the saved directory and execute the file:
node hello.js
brew update && brew install phantomjs
phantomjs
Create a file and save it. Change to the saved directory and execute the file:
phantomjs hello.js
I am not sure whether these all go on the same terminal line