Setting up your tools
Install a friendly editor, use the browser console for quick experiments, install Node.js LTS, run a JavaScript file, and know when an online playground is enough.
- 01Choose the right surfaceTell the editor, console, terminal, Node.js, and playgrounds apart.
- 02Run a real fileCreate
hello.js, run it withnode hello.js, and read the printed output. - 03Troubleshoot setupCheck
node --version, understand PATH errors, and restart a terminal after installing.
Your JavaScript workshop
JavaScript starts with a surprisingly small toolkit. You need a place to write code, a place to try quick ideas, and a way to run files outside the browser. The previous lessons introduced JavaScript, its history, engines, runtimes, and manuals. This lesson turns that map into a working desk.
Think of your setup as a workshop. The editor is the workbench where you build things you want to keep. The browser console is a scratchpad for tiny experiments. The terminal is the control panel where you type commands. Node.js is a second stage that runs your scripts outside the browser. Online playgrounds are a fully equipped rental kitchen: useful when you cannot install tools or want to share a quick idea.
Good workshops have different surfaces for different jobs. You do not write a permanent blueprint on a sticky note, and you do not test a tiny measurement by rebuilding the whole table. JavaScript tools work the same way: choose the surface that matches the job.
- In real life: Workbench
- In JavaScript: Editor: write and save files
- In real life: Scratchpad
- In JavaScript: DevTools console: quick experiments
- In real life: Control panel
- In JavaScript: Terminal: run commands
- In real life: Second stage
- In JavaScript: Node.js: run JavaScript outside the browser
Where the analogy stops: A real workshop has separate machines. On your computer, VS Code can show the editor and an integrated terminal in the same window, and the browser console is part of DevTools.
A JavaScript development environment is the set of tools you use to write, run, inspect, and share JavaScript programs.
VS Code: your workbench
INTERACTIVEA code editor is a text editor that understands programming files. Visual Studio Code is a popular free choice, but the ideas transfer to other editors too: files on the left, code in the middle, commands and status around the edges.
Install VS Code from its official site, open a folder for your practice files, and create a file named hello.js. Save early and often. A saved file is something Node.js can run; unsaved text in the editor is only a draft.
Editor: This is where code you want to keep belongs. VS Code colors syntax, matches brackets, and points out many typos before you run the file. Shortcut: Type and save with Cmd/Ctrl+S.
The Command Palette is worth learning on day one: press Cmd+Shift+P on Mac or Ctrl+Shift+P on Windows/Linux and type the action you want. Quick Open (Cmd/Ctrl+P) jumps to a file by name. The integrated terminal toggles with Ctrl+` (the backtick key, left of 1 on US keyboards), the same terminal you can also open from your operating system.
The DevTools console
INTERACTIVEThe browser console is still the fastest place to ask “what does this expression do?” You already used it for 2 + 2 in Why JavaScript?. Now add a few habits that make it practical.
- Enter runs what you typed.
- Shift+Enter starts a new line so you can write a tiny program first.
- The up arrow usually brings back previous commands.
- Use the clear button or
console.clear()to clean the view. - Errors show up in red, often with a file name and line number.
$_is a Chrome/Edge convenience for the last result; do not depend on it in code.
const tool = "console";const note = "Use Shift+Enter for a new line";console.log(tool + ": " + note);console: Use Shift+Enter for a new line
Use Shift+Enter to add lines, then press Enter to run the whole mini-program.
The console is perfect for experimenting, but refreshing the page or closing DevTools can remove your typed work. When an idea matters, move it into a file in your editor.
Installing Node.js
CHECKLISTNode.js lets you run JavaScript from the terminal. In the Engines, runtimes & hosts lesson you saw the big idea: Node.js combines the V8 JavaScript engine with host APIs such as the file system. For this course, install the LTS version. LTS means “Long-Term Support”: the steady version most learners and teams should choose.
- Download Node.js LTS from the official Node.js website.
- Run the installer and accept the default PATH option if it asks.
- Close and reopen your terminal so it sees the new command.
- Type
node --versionandnpm --version.
$ node --versionv22.0.0 # example: your LTS version may differ$ npm --version10.0.0 # example: yours may differ$ node hello.jsOpening hello.jsHello, Mina!Ready for the next lesson.Your numbers will differ from the example. That is okay. The important part is that both commands print a version instead of an error. npm is installed with Node.js; you will use it later for packages and project scripts.
| Command | What it checks | Good result | Common problem |
|---|---|---|---|
node --version | Can the terminal find Node.js? | A version such as v22... | command not found or 'node' is not recognized |
npm --version | Can the terminal find npm? | A version number | Node installed incompletely or terminal needs restart |
node hello.js | Can Node run your file? | Your program's printed lines | Wrong folder, wrong file name, or a syntax error |
Running a file
STEP THROUGHCreate a file named hello.js in your practice folder. A JavaScript file runs from the first statement to the last. The terminal output is only what the program prints with console.log or what an error reports.
This is a guided replay of running node hello.js: predict each terminal line, then step through the file top to bottom.
script
console.log("Opening hello.js");const message = "Hello, " + learner + "!";console.log(message);console.log("Ready for the next lesson.");To run the same file yourself, open a terminal in the folder that contains hello.js and type node hello.js. If Node says it cannot find the file, check the folder and spelling. If JavaScript reports a syntax error, read the line number and compare it with your editor.
The same actor can perform on two stages. On the browser stage, the props are buttons, forms, and a page. On the Node.js stage, the props include files, folders, and terminal input/output.
- In real life: Browser stage
- In JavaScript: JavaScript can interact with a web page
- In real life: Node stage
- In JavaScript: JavaScript can read files, run tools, and print to a terminal
- In real life: Same actor, different props
- In JavaScript: Same language, different host APIs
Where the analogy stops: Node.js is not a browser. There is no document or page button unless a tool creates one. Browser JavaScript and Node.js share the language, not every available object.
Online playgrounds
PRACTICALSometimes the right setup is no setup. Online playgrounds such as CodePen, JSFiddle, and StackBlitz let you write and run snippets in a browser. They are excellent for sharing a reproduction, testing a tiny idea on a borrowed computer, or following a lesson when installation is not possible yet.
A playground is not a safe place for secrets, private company code, or anything you cannot share with a third party. It is also not a full replacement for learning local files: real projects need folders, version control, installed packages, and terminal commands.
Use a playground like a rental kitchen: great for trying a recipe, not where you store your only copy of the cookbook.
Where would you do this?
SORTERThe best tool depends on the job. Sort each task into the place you would normally do it. There is no shame in changing surfaces: quick console experiments often become saved editor files later.
- Write
app.jsthat you want to keep and edit tomorrow - Try
0.1 + 0.2quickly - Run
node hello.js - Share a runnable snippet with a friend without installing anything
- Rename a folder of practice files
- Read the red error from a page you are testing
- Check whether Node.js is installed with
node --version - Try a tiny idea on someone else’s computer
Drag or select each card into the place you would usually do that task.
Where you will use this
A normal beginner workflow looks like this:
- Open your course folder in VS Code.
- Create or edit a file such as
hello.js. - Save the file.
- Open the terminal in that same folder.
- Run
node hello.js. - Read output or errors, edit, save, and run again.
You will still use the browser console constantly: to test one expression, inspect an error on a page, or try a three-line idea with Shift+Enter. You will use online playgrounds when you need a link that someone else can open immediately.
Common misconceptions
CLARIFY- “VS Code runs JavaScript by itself.” It edits files. Node.js or a browser runs the code.
- “The console is only for mistakes.” It is also a scratchpad for experiments and a place to print messages.
- “npm and Node.js are the same thing.” Node runs JavaScript; npm helps manage packages and scripts.
- “Online playgrounds mean I never need local tools.” Playgrounds are convenient, but projects need local folders and terminal commands.
- “An error means the setup is broken.” Many errors simply mean a typo, wrong folder, or file not saved.
| Tool | Best for | Not for |
|---|---|---|
| Editor | Keeping and organizing files | Instant one-off calculations |
| Browser console | Quick experiments and page errors | Long-term saved work |
| Terminal | Commands such as node hello.js | Editing many lines comfortably |
| Node.js | Running JavaScript files outside the browser | Showing a web page by itself |
| Online playground | Sharing quick runnable demos | Private code or secrets |
Practice exercises
5 EXERCISESInstall Node.js LTS if needed, then check both version commands. Type the word that describes what a successful command prints.
Run node --version and npm --version. If both print a version number, your terminal can find them. If not, install Node.js LTS or restart the terminal after installing.
Read the program and predict the two lines it prints.
const file = "hello.js";
console.log("Running " + file);
console.log("Done");Line 2 joins Running with hello.js, so it prints Running hello.js. Line 3 prints Done on the next line.
In the browser console, enter a two-line program that stores 0.1 + 0.2 in total and prints it.
const total = 0.1 + 0.2;
console.log(total);Use Shift+Enter to write both lines before running them. JavaScript prints 0.30000000000000004, a decimal precision detail you will revisit later.
Create hello.js, paste the starter code, save it, and run it with Node.js. What greeting appears?
const learner = "Mina";
console.log("Hello, " + learner + "!");const learner = "Mina";
console.log("Hello, " + learner + "!");The file stores Mina in learner, joins it into a greeting, and console.log prints Hello, Mina! in the terminal.
This file fails when you run it. Type the corrected second line.
const tool = "Node";
consle.log("Use " + tool);const tool = "Node";
console.log("Use " + tool);The method is console.log, not consle.log. Typos in names are common; the error points you back to the line to inspect.
Check your understanding
7 QUESTIONSQuestion 1 of 7Which tool is the best place to edit a JavaScript file you want to keep?
Choose an answer to see the explanation.
Question 2 of 7What does this program print?
Read the code, then predictconst file = "hello.js"; console.log("Running " + file); console.log("Done");Choose an answer to see the explanation.
Question 3 of 7You installed Node.js, but
node --versionstill says command not found. What should you try first?Choose an answer to see the explanation.
Question 4 of 7In most browser consoles, what does Shift+Enter do while you are typing?
Choose an answer to see the explanation.
Question 5 of 7Which command asks Node.js to run a file named
hello.js?Choose an answer to see the explanation.
Question 6 of 7What does this print?
Read the code, then predictconst learner = "Mina"; console.log("Hello, " + learner + "!");Choose an answer to see the explanation.
Question 7 of 7When is an online playground the best choice?
Choose an answer to see the explanation.
Key takeaways
- Use an editor such as VS Code for code you want to keep.
- Use the browser console as a fast scratchpad and error viewer.
- Install Node.js LTS so the
nodecommand can run JavaScript files. - The terminal runs commands; it is not the same thing as JavaScript code.
- Online playgrounds are great for quick, shareable experiments, not secrets.
A development environment is your editor, console, terminal, runtime, and sharing tools working together so you can write and run programs.
Up next: Hello, world! You will put code on a page and in a file without diving deeply into script tags yet.