You'll run JavaScript in main environments. The first is your web browser. Every browser has a JavaScript engine built in. Chrome uses V8, Firefox uses SpiderMonkey, and Safari uses JavaScriptCore.
The second environment is Node.js, which lets you run JavaScript outside the browser. Node.js also uses the V8 engine. This means you can use JavaScript for both websites and server applications.