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:
python myfile.py.
practice.js
Browser console
Open any browser, pressF12, and use the Console tab for quick experiments.
console.log() needed for simple expressions.
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:
- Write code in the editor panel
- Switch to the terminal (
Ctrl+`) - Run
node filename.js - See the output
- 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?
| Environment | Best for |
|---|---|
Node.js (node file.js) | Writing and running JavaScript files, course exercises |
Browser console (F12) | Quick experiments, testing one-liners, DOM/browser APIs |
| VS Code terminal | Everything — it runs Node.js from within your editor |
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