Unit 0: Setting Up Your JavaScript Development Environment
Before you start: complete Unit P: Computing Foundations Primer. It explains the language-neutral vocabulary and concepts used in every language track, using non-visual examples.
Lesson 0.1: Installing Node.js
Node.js 26 LTS lets you run JavaScript on your computer (outside a browser) using the terminal. Install the current LTS line, not an obsolete tutorial version or an experimental prerelease.
Reading References
- Official Node.js downloads and installation documentation.
Learning Objectives
- Install a supported Node.js LTS runtime and npm.
- Verify the runtime from a terminal.
Concept Explanation
Node.js is the JavaScript runtime used for this course. npm is the package manager distributed with Node.js. The terminal must be able to locate both commands through PATH.
Installing Node.js
Download Node.js 26 LTS from https://nodejs.org/.
Windows
- Download the
.msiinstaller. - CRUCIAL STEP: Ensure “Add to PATH” is checked during installation.
- Activate “Install” and “Finish”.
macOS
- Download the
.pkginstaller and follow the prompts. - Or use Homebrew:
brew install node
Linux (Debian/Ubuntu)
curl -fsSL https://deb.nodesource.com/setup_26.x | sudo -E bash -
sudo apt install nodejs
Windows Powershell
winget install --id OpenJS.NodeJS.LTS -e
Verify Installation
node --version # Should show v26.x.x (26.13.0 or a newer 26.x maintenance release)
npm --version # Should show npm version
Windows Powershell
node --version # Should show v26.x.x (26.13.0 or a newer 26.x maintenance release)
npm --version # Should show npm version
Worked Example
node --version
npm --version
node -e "console.log(2 + 3)"
The third command verifies that Node.js can execute a short JavaScript expression.
Expected Behavior or Output
The terminal reports a Node.js version in the documented supported major line and an npm version. The REPL accepts a short expression and prints its result.
Common Mistakes
- Installing a runtime but not reopening the terminal, so PATH changes are not visible.
- Installing a version that is unsupported or inconsistent with the course baseline.
- Confusing Node.js with npm; Node.js runs JavaScript and npm manages packages.
Activities
- Install Node.js using the official download or package-manager instructions for the operating system.
- Run
node --versionandnpm --version. - Open the Node.js REPL, evaluate
2 + 3, and exit. - If a command is not found, identify whether the runtime is installed and whether PATH is configured.
Accessibility Practice
Use keyboard navigation in the installer and terminal. Read each installation prompt and verify the runtime with text commands rather than relying on an icon or graphical success message.
Skills Checklist
- Running
node --versionshows the version number. - Running
npm --versionshows the npm version.
Expected Behavior or Output
The terminal reports a Node.js version in the documented supported major line and an npm version. The REPL accepts a short expression and prints its result.
Worked Example
node --version
npm --version
node -e "console.log(2 + 3)"
The third command verifies that Node.js can execute a short JavaScript expression.
Common Mistakes
- Installing a runtime but not reopening the terminal, so PATH changes are not visible.
- Installing a version that is unsupported or inconsistent with the course baseline.
- Confusing Node.js with npm; Node.js runs JavaScript and npm manages packages.
Activities
- Install Node.js using the official download or package-manager instructions for the operating system.
- Run
node --versionandnpm --version. - Open the Node.js REPL, evaluate
2 + 3, and exit. - If a command is not found, identify whether the runtime is installed and whether PATH is configured.
Accessibility Practice
Use keyboard navigation in the installer and terminal. Read each installation prompt and verify the runtime with text commands rather than relying on an icon or graphical success message.
Lesson 0.2: Setting Up VS Code or Theia IDE
For a new project, create a package manifest with npm init -y. Choose one module system and declare it explicitly: set package.json to { “type”: “commonjs” } for the CommonJS examples in the early lessons, or { “type”: “module” } for the ES module examples later in the course. Do not combine the two syntaxes in one file.
- Install Visual Studio Code or Theia IDE. Theia supports many VS Code extensions through Open VSX, but check that the required extensions are available and test them with the learner’s screen reader.
- In VS Code, press
Ctrl + Shift + Xto open Extensions. In Theia, open View → Extensions or run Toggle Extensions View. Install:- JavaScript (ES6) code snippets — Handy code shortcuts.
- ESLint — Catches common errors.
- In VS Code, enable Screen Reader Mode:
Ctrl + Shift + P→ “Toggle Screen Reader Optimized”. In Theia, enable its corresponding screen-reader setting and verify editor, terminal, diagnostics, and extension announcements.
Reading References
- Visual Studio Code accessibility documentation.
- Theia IDE documentation and extension marketplace guidance.
Learning Objectives
- Configure an editor for JavaScript development.
- Navigate files, editor, terminal, and diagnostics by keyboard.
Concept Explanation
An editor provides source navigation and language tooling; it does not replace the Node.js runtime. Keyboard shortcuts and extension availability can differ between VS Code and Theia.
VS Code Shortcuts for JavaScript (Theia keybindings may differ)
| Action | Shortcut |
|---|---|
| Run file (via terminal) | Ctrl + \`` then node filename.js` |
| Command Palette | Ctrl + Shift + P |
| Problems View | Ctrl + Shift + M |
| Next Error | F8 |
| Format Code | Shift + Alt + F |
| Go to Definition | F12 |
Verify editor tooling and the Node.js project environment
Visual Studio Code
- JavaScript language support is built in. Confirm that the built-in JavaScript and TypeScript language features are enabled for the workspace.
- Install ESLint from the Extensions view when the project uses ESLint. The JavaScript snippets extension is optional and is not required to compile or run JavaScript.
- Open the project root (the folder containing
package.json) as the workspace. Open the integrated terminal from that folder and verify thatnode --versionandnpm --versionreport the expected Node.js 26 LTS and npm versions.
Theia IDE
- Open the Extensions view and use the configured Open VSX registry to find JavaScript/TypeScript language tooling, ESLint integration, and (if needed) Node.js debugging support.
- Verify availability and compatibility with the installed Theia release before depending on an extension. Do not assume every Visual Studio Marketplace extension is available through Open VSX.
- Test syntax diagnostics, completion, navigation, terminal operation, debugging (if used), and screen-reader announcements. The editor extension supplies language tooling; Node.js remains the runtime and must be installed and available to the terminal.
Use the project’s local toolchain consistently
- Keep
package.json,package-lock.json, andnode_modulesin the project root. Install project dependencies locally withnpm installornpm install --save-dev package-name; do not install course tools globally. - Run project tools with
npm run script-nameornpx tool-name. Use the integrated terminal opened at the project root so npm resolves the local dependencies. - Check that the editor’s integrated terminal and the system terminal resolve the same Node.js installation and version. If they differ, correct the terminal PATH or runtime configuration before continuing.
- For these terminal-first lessons, run programs with
node filename.jsfrom the project root. Do not rely on an editor’s generic Run button until you have verified that it invokes the same Node.js runtime and working directory.
Advanced editor options
Experienced coders may prefer JetBrains IDEs, such as WebStorm. They are advanced alternatives, not the recommended starting point for this beginner curriculum. This course does not provide JetBrains installation or usage instructions.
Worked Example
Use the keyboard to open a project folder, create hello.js, move focus to the integrated terminal, and run node hello.js.
Expected Behavior or Output
The editor can open a JavaScript project, announce file names and diagnostics, and run the same file from its integrated terminal. The exact keyboard shortcuts may differ between VS Code and Theia.
Common Mistakes
- Assuming VS Code and Theia have identical extensions or keyboard shortcuts.
- Installing extensions without checking compatibility with the chosen editor.
- Relying on a mouse-only run button instead of terminal execution.
Activities
- Open the Command Palette using the keyboard.
- Install or verify JavaScript language support and Node.js tooling.
- Navigate between editor, terminal, and file explorer without a mouse.
- Confirm that the editor announces syntax errors and file names accessibly.
Accessibility Practice
Test the learner’s actual screen reader and braille display configuration. Do not claim universal accessibility; document editor, operating system, and access-technology versions used.
Skills Checklist
- I can open and navigate a JavaScript workspace.
- I can use the keyboard to move between editor and terminal.
- I can locate diagnostics and read their messages.
- I can verify the installed JavaScript language support.
Lesson 0.3: Your First JavaScript File
Reading References
- MDN: JavaScript first steps.
- Node.js: Running JavaScript files.
Learning Objectives
- Create and save a JavaScript source file.
- Run the file and distinguish script execution from the REPL.
Concept Explanation
A source file stores a repeatable program. The Node.js REPL evaluates individual expressions interactively; running a file executes its statements in sequence.
Hello World
Create hello.js:
console.log("Hello, World!");
console.log("Welcome to JavaScript!");
Run it:
node hello.js
Windows Powershell
node hello.js
The Node.js REPL
For quick experiments, open an interactive session:
node
Windows Powershell
node
Type JavaScript directly and press Enter to execute. Type .exit to quit.
Key Differences from Python
| Python | JavaScript |
|---|---|
print() | console.log() |
# for comments | // for single-line, /* */ for multi-line |
| No semicolons required | Semicolons optional but recommended |
| Indentation defines blocks | Curly braces {} define blocks |
def for functions | function or => for functions |
True/False | true/false (lowercase) |
None | null and undefined |
len(x) | x.length |
Worked Example
console.log("Hello, World!");
console.log("Welcome to JavaScript.");
Run the saved file with node hello.js.
Expected Behavior or Output
Running the saved file prints the exact greeting text in the terminal, in the order written in the file.
Common Mistakes
- Saving source code with a hidden extra extension such as
.js.txt. - Typing smart quotes instead of straight quotation marks.
- Running the REPL command instead of executing the saved file.
Activities
- Create and save
hello.js. - Run the file from the terminal.
- Enter a short arithmetic expression in the Node.js REPL.
- Explain the difference between a saved script and an interactive REPL session.
Accessibility Practice
Ensure the file name, extension, and terminal output are announced in sequence. Keep a terminal path available even when the editor provides a run command.
Skills Checklist
- I can create a
.jsfile and run it withnode filename.js. - I can use the Node.js REPL for quick experiments.
Expected Behavior or Output
Running the saved file prints the exact greeting text in the terminal, in the order written in the file.
Worked Example
console.log("Hello, World!");
console.log("Welcome to JavaScript.");
Run the saved file with node hello.js.
Common Mistakes
- Saving source code with a hidden extra extension such as
.js.txt. - Typing smart quotes instead of straight quotation marks.
- Running the REPL command instead of executing the saved file.
Activities
- Create and save
hello.js. - Run the file from the terminal.
- Enter a short arithmetic expression in the Node.js REPL.
- Explain the difference between a saved script and an interactive REPL session.
Accessibility Practice
Ensure the file name, extension, and terminal output are announced in sequence. Keep a terminal path available even when the editor provides a run command.
Lesson 0.4: Node.js Projects, Terminal Execution, and Dependencies
Reading References
- Node.js documentation: Getting Started and Command-Line API.
- npm documentation: package.json and npm scripts.
Learning Objectives
- Create a project directory and initialize a Node.js package.
- Run a JavaScript file from a terminal and distinguish the working directory from the file location.
- Explain what package.json records and when a dependency is needed.
- Use npm scripts without relying on mouse-only editor controls.
Concept Explanation
A project is a directory containing source files and supporting configuration. Node.js executes a file with node filename.js. The terminal’s current working directory determines how relative paths such as ./data.json are resolved. The package.json file records project metadata, scripts, dependencies, and module mode. For this course, use one explicit module system per project: CommonJS with "type": "commonjs", or ECMAScript modules with "type": "module". Do not mix require() and import in the same instructional example.
Worked Example
From the terminal, create and enter a project directory:
mkdir js-foundations
cd js-foundations
npm init -y
Create hello.js:
"use strict";
const student = "Avery";
console.log(`Hello, ${student}! Your Node.js project is ready.`);
Run it:
node hello.js
Expected output:
Hello, Avery! Your Node.js project is ready.
Add a script to the scripts object in package.json:
{
"type": "commonjs",
"scripts": {
"start": "node hello.js"
}
}
Run npm start. The script should print the same line.
Expected Behavior or Output
The project can be run with both node hello.js and npm start; both commands print the same greeting.
Common Mistakes
- Running the command from the parent directory, so Node.js cannot find
hello.js. - Naming the file
hello.js.txtbecause file extensions are hidden. - Assuming a package must be installed for built-in Node.js modules such as
node:fsornode:readline. - Mixing CommonJS and ES module syntax without configuring module mode.
Activities
- Use
pwd(macOS/Linux) orGet-Location(PowerShell) to announce the current directory, then navigate into the project. - Create
profile.jsand print the canonical student name Avery, age 16, and favorite subject Computer Science. - Add a
startnpm script and run the same program withnpm start. - Deliberately run Node.js from the wrong directory; read the error, correct the working directory, and rerun.
Accessibility Practice
Use terminal commands and keyboard navigation throughout. Confirm the editor announces the file name and extension. Read the complete terminal error before acting on it. Keep output textual and sequential; do not make successful execution depend on a color change or visual notification.
Skills Checklist
- I can create and enter a project directory from the terminal.
- I can initialize and describe a package.json file.
- I can run a JavaScript file with node and an npm script.
- I can diagnose a wrong-working-directory error.
- I can explain why a project should use one explicit module system.