You can execute JavaScript code really easily using just a web browser. However, when JavaScript is running in the browser it typically runs inside a web page.

Create a JavaScript file, you can call it whatever you like - just make sure that it has a .js extension file. Create a webpage using HTML 5 markup. Then add a link to the JavaScript file using the script tag:

<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="main.js"></script>