run js script in sublime text 3 code example

Example: run javascript in sublime

Create JavaScript build system in Sublime Text #
Every built system is described on JSON file with .sublime-build extension. 
To create new one go to Tools > Build System > New Build System… 
If you are mac OS user, copy and paste this bit of code:
!!! Remember to save the file as   filename.sublime-build

{
  "cmd": ["/usr/local/bin/node", "$file"],
  "selector": "source.js"
}

If you are window user, copy and paste this bit of code: 
{
  "cmd": ["C:/Program Files/nodejs/node.exe", "$file"],
  "selector": "source.js"
}