Around 1:51 in the video, notice how she puts a <script> tag in there? The way it works is like this:

Create an html file (that's just a text file with a .html ending) somewhere on your computer. In the same folder that you put index.html, put a javascript file (that's just a textfile with a .js ending - let's call it game.js). Then, in your index.html file, put some html that includes the script tag with game.js, like Mary did in the video. index.html should look something like this:

<html>
    <head>
        <script src="game.js"></script>
    </head>
</html>

Now, double click on that file in finder, and it should open it up in your browser. To open up the console to see the output of your javascript code, hit Command-alt-j (those three buttons at the same time).

Good luck on your journey, hope it's as fun for you as it has been for me so far :)

Answer from thataustin on Stack Overflow
🌐
Playcode
playcode.io › javascript-compiler
JavaScript Compiler Online - Run JS Code Free | Playcode
JavaScript compiler online to run JavaScript online instantly in your browser. Use AI to generate code, fix bugs, and explain errors. TypeScript, JSX, and npm packages supported. Free, no signup required.
Discussions

Executing a JavaScript file directly from the browser - Stack Overflow
A dev might want to make something in JS and not immediately lose it like they would if they typed it in dev tool's console. But Domenic's answer below makes sense. ... This is not possible. The browser has no idea what context the JavaScript should run in; for example, what are the properties ... More on stackoverflow.com
🌐 stackoverflow.com
how do i execute my javascript code ?
A quick and simple way to run JS without installing anything is with your web browser. On any tab you can hit F12 or Ctrl+Shift+I, which should open a sidebar to the right -- that's the dev tools. The default tab is called "Elements"; look for a tab called "Console". The console is essentially a browser-based terminal that can readily run JavaScript code. Type console.log("hello") and hit Enter. The word "hello" will be printed on the next line. More on reddit.com
🌐 r/learnjavascript
12
7
November 19, 2021
[deleted by user]
Everyone on this thread is correct about Node.js, that is technically the correct answer, but I am not sure if that responds your question. Javascript’s main goal is to run in your browser (Chrome, Safari, etc) and you don’t have to install anything additional for it to work. You can practice on websites like jsbin.com without installing anything on your computer. More on reddit.com
🌐 r/learnjavascript
45
53
August 21, 2021
All javascript not working in chrome

OK, I had this issue and finally resolved it after several days. Clearing your cache and clearing your cookies do absolutely nothing. The problem is Reddit is using local storage https://www.w3schools.com/html/html5_webstorage.asp . For whatever reason there is something wrong with that. I closed Chrome and then went to ~/.config/google-chrome/Default/Local Storage and deleted everything with reddit in the file name. Your location will vary depending on OS.

More on reddit.com
🌐 r/bugs
12
10
May 8, 2017
People also ask

How fast is the online JavaScript compiler?
Playcode's JavaScript compiler online is optimized for speed. When you run JavaScript online, initial compilation takes 100-500ms depending on project size. Incremental builds complete in 20-50ms. The fastest way to compile JavaScript online. That's often faster than running a local Node.js bundler because everything runs in memory with no disk I/O.
🌐
playcode.io
playcode.io › javascript-compiler
JavaScript Compiler Online - Run JS Code Free | Playcode
What is a JavaScript compiler?
A JavaScript compiler transforms your JavaScript code into optimized, executable code. Unlike traditional compilers that produce machine code, online JavaScript compilers and editors like Playcode bundle your code, resolve imports, and transpile modern syntax (ES2026, TypeScript, JSX) into browser-compatible JavaScript that runs instantly. You can compile and edit JavaScript online with zero setup using our JavaScript editor.
🌐
playcode.io
playcode.io › javascript-compiler
JavaScript Compiler Online - Run JS Code Free | Playcode
Does the JavaScript compiler work offline?
Yes, you can run JavaScript online even offline once the page is loaded. The compiler runs entirely in your browser using WebAssembly, so you can keep coding and compile JavaScript without an internet connection. Your code is saved locally and syncs when you're back online.
🌐
playcode.io
playcode.io › javascript-compiler
JavaScript Compiler Online - Run JS Code Free | Playcode
🌐
Codecademy
codecademy.com › article › running-javascript-in-the-browser-console
Running JavaScript in the Browser Console | Codecademy
Remember that the console is a REPL, so we can run JS code, such as arithmetic expressions, by typing it after the > prompt and hitting Enter/Return. The expression will be evaluated, and the return value is printed to the console on the next line following the < arrow: Similarly, we can use comparison operators to compare values, which will evaluate to true or false: In some newer browsers, you may notice that the console displays a preview of the return value as you’re typing, even before you hit Enter/Return.
🌐
ReqBin
reqbin.com › code › javascript
Online JavaScript Code Runner
One of the advantages of JavaScript is that you can write and execute simple JavaScript code right in the console of your web browser by simply pressing F12; no third-party applications are required to run JavaScript code.
Find elsewhere
🌐
BrowserStack
browserstack.com › home › guide › how to run javascript code in a browser?
How to Run JavaScript Code in a Browser? | BrowserStack
November 26, 2024 - Go to Console tab. ... Hit Enter to run. ... Open Chrome → Press Ctrl + Shift + I (Windows) / Cmd + Option + I (Mac). Select Console. ... Press Enter. ... Open console with Option + Cmd + C. ... Press Enter.
🌐
Chrome Web Store
chromewebstore.google.com › detail › run-javascript › lmilalhkkdhfieeienjbiicclobibjao
Run Javascript - Chrome Web Store
Inject HTML, CSS or JavaScript into any web-page. The changes you make are applied every time you visit the specified website(s). ... Average rating 4.7 out of 5 stars. Learn more about results and reviews. Quickly disable/enable JavaScript for the Chrome browser in 1 click.
🌐
RunJS
runjs.app › play
Online JavaScript Playground
An easy-to-use online JavaScript playground with live feedback. Write and run JavaScript instantly. Great for learning and prototyping.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-run-javascript-in-chrome-browser
How to run JavaScript in Chrome Browser ? - GeeksforGeeks
November 13, 2023 - Browser Console: It also has an inbuilt developer console that supports the running of JavaScript. To do this, you must first open the console by right clicking on any web page, selecting “Inspect” and moving to the console tab.
🌐
Enable JavaScript
enable-javascript.com
How to enable JavaScript in your browser and why
On the web browser menu click on the "Customize and control Google Chrome" and select "Settings". In the "Settings" section click on the "Show advanced settings..." Under the the "Privacy" click on the "Content settings...". When the dialog window opens, look for the "JavaScript" section and ...
🌐
Automation Anywhere
community.automationanywhere.com › developers-forum-36 › run-javascript-in-browser-86395
Run Javascript in browser - Community - Automation Anywhere
May 14, 2023 - Howdy. I had the same problem. I solved it by putting the function and its variables into a string, writing it to file, then calling the file using the Javascript in browser. Works a treat.
🌐
Chrome Developers
developer.chrome.com › docs › chrome devtools › run javascript in the console
Run JavaScript in the Console | Chrome DevTools | Chrome for Developers
April 18, 2018 - Type the following code into the Console. Try typing it out, character-by-character, rather than copy-pasting it. ... See define default values for function arguments if you're unfamiliar with the b=20 syntax. Now, call the function that you just defined. ... Figure 4. How the Console looks after evaluating the expressions above. add(25) evaluates to 45 because when the add function is called without a second argument, b defaults to 20. You will not be able to run any code in this console session until your function has returned.
🌐
Fireship
fireship.io › courses › javascript › beginner-js-where-to-run
Learn Javascript - How to Run JavaScript Code | Fireship.io
In Chrome, you can open the developer console with Ctrl+Shift+J (Windows) or Ctrl+Option+J (Mac), or manually from the settings menu by selecting More Tools -> Developer Tools. The console allows you to run code in the browser, similar to how
🌐
LambdaTest
lambdatest.com › software-testing-questions › run-javascript-code-in-browser
How to run JavaScript code in a browser?
To run JavaScript code in a browser, you can create an HTML file with a <script> tag that references a JavaScript file or add the JavaScript code directly within the <script> tag in the HTML file.
🌐
Testmu
testmu.ai › software-testing-questions › how-to-run-javascript-in-chrome-browser
How to Run JavaScript in Chrome Browser: A Quick Guide
Learn how to run JavaScript in Chrome using DevTools, the address bar, online editors, and extensions for testing, debugging, and automating scripts.
🌐
WebPlatform
webplatform.github.io › docs › tutorials › your_first_look_at_javascript
Your first look at JavaScript · WebPlatform Docs
To execute JavaScript in a browser you have two options — either put it inside a script element anywhere inside an HTML document, or put it inside an external JavaScript file (with a .js extension) and then reference that file inside the HTML document using an empty script element with a ...
🌐
DEV Community
dev.to › mrizwanashiq › how-to-run-javascript-2nfn
How to run JavaScript - DEV Community
May 27, 2023 - You can open the browser console by pressing F12, or by right-clicking on empty space in the browser, and then clicking on Inspect. Then, click on Console tab. Then, write your JS code in the console.