Skip to main content

Three ways to run JavaScript

You’ll use three environments during this course. Each one is useful for different things.

Node.js in the terminal

Run any .js file from your terminal:
This is what you’ll use for most of the learning sections (JavaScript Core, Working with Data, Async & APIs). It’s the closest thing to running python myfile.py.
practice.js
Create a practice.js file in your js-practice folder. Use it as a scratch pad — edit it, run it, edit it again. You don’t need a new file for every experiment.

Browser console

Open any browser, press F12, and use the Console tab for quick experiments.
The browser console is interactive — it evaluates each line and shows the result. No console.log() needed for simple expressions.
The browser console has access to web APIs (like document and window) that Node.js doesn’t have. If you’re testing pure JavaScript logic, either environment works. If you’re testing DOM or browser features, use the browser console.

VS Code integrated terminal

The integrated terminal in VS Code (Ctrl+`) runs Node.js commands without leaving your editor. This is where you’ll spend most of your time:
  1. Write code in the editor panel
  2. Switch to the terminal (Ctrl+`)
  3. Run node filename.js
  4. See the output
  5. Edit and repeat
Later in the course, when you work with React, you’ll run npm run dev in this terminal to start a development server. The server watches for file changes and refreshes your browser automatically.

Which one should I use?

For this course, you’ll mostly use VS Code’s integrated terminal to run Node.js. The browser console is there for quick checks.

What’s next?

You can write and run JavaScript. Before we dive into the language itself, let’s understand npm — the tool that manages JavaScript packages and dependencies.

Understanding npm

How JavaScript manages packages and dependencies