JavaScript in v8 at macOS terminal
Sometimes we need to run our script JS directly from our preferred IDE, even after many of them have evolved their integration with major browsers, there are still those who prefer something more root.
To run JavaScript via Google's V8 Javascript engine, directly from you MacOSX terminal, you'll need to:
-
Install Homebrew first:
$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
$ which brew
/usr/local/bin/brew
-
Install the V8 engine:
$ brew install v8
-
Start the V8 console, just run v8!
$ v8 /Users/helmed/cajs/whileLoops/Project/16-whatYoullBuild.js
Tip: To close the terminal, just type quit() and press enter!
Written by Hélio Cabral Medeiros
Related protips
Have a fresh tip? Share with Coderwall community!
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside