Testing JavaScript code can easily be done now with today’s browser in console mode. If you want to this within an IDE like Sublime Text from the press of a button, read on.
The first thing you’ll need is a JavaScript interpreter like Node.js. Get it from http://nodejs.org/ . Then in Sublime Text go to:
Tool -> Build System -> New Build System
Create a new build system file. In this example, we’ll use JavaScript.sublime-build
By default, it’ll create it under the path:
C:\Users\Dan\AppData\Roaming\Sublime Text 2\Packages\User
Once you do that, configure the build file using the settings from the Sublime Text official docs.
So your config file will look like this:
{ "cmd": ["C:/Program Files (x86)/nodejs/node.exe", "-p", "$file"] }
and that should be it.
So now when you press F7, the build system will run and the output will be shown like so: