Lesson 6.0

Orientation: what this chapter delivers

Artifact: A map of the chapter and a preview of the assignment

1. The promise

You'll know exactly what the next twenty units cover, what they don't cover, and what the chapter assignment looks like. By the end of this unit you can hold the target in your head while every later unit moves you a step closer to it.

2. The mental model

This chapter is a tour of a language. Ch 7 is a tour of the building the language lives in.

You're learning to speak first. You'll move into the apartment next chapter.

JavaScript is a programming language. It was designed in 1995 to run inside web browsers. It now also runs on servers, on tiny devices, and inside almost every editor you've used. When you finish this chapter you can read the JavaScript you'll see in every later chapter of this course.

(DIAGRAM: the chapter map — node tree — three branches from "JavaScript, the language": Language Core (6.3 to 6.16), Async (6.17 to 6.20), Assignment (6.assign))

The chapter at a glance:

  • Types and values — what the language can hold (6.3).
  • Variables and operators — how you name and combine those values (6.4, 6.5).
  • The small stuff — strings, numbers, arrays, objects (6.6 to 6.9).
  • Control flow and loops — branching and repeating (6.10, 6.11).
  • Functions, scope, closures, and this — how code is packaged and how it remembers context (6.12 to 6.14).
  • Modules and errors — splitting code into files and handling failure (6.15, 6.16).
  • The async half — the event loop, promises, async/await, and fetch (6.17 to 6.20).
  • The chapter assignment — a Node script that calls a public API and prints a clean summary.

What this chapter is not about: nothing here covers the DOM, document, window, click events, or browser storage. Those are Ch 7. If you wonder "where is the part where I click a button and something happens?" — that's the next chapter, not this one.

One policy on AI tools: don't paste this chapter into an AI and ask for shortcuts. This is the language the AI itself writes in. You have to read and write it yourself before you can judge what the AI produces.

3. You do it, with me

Open VSCode. Create a new empty file called script.js. Save it inside a fresh folder named ch06.

(SCREENSHOT: VSCode with a new file script.js open, empty — full window — file name tab highlighted)

Open a terminal. Type node --version. Press Enter.

bashterminal — check that Node is installed
node --version

You should see a version number starting with v20 or higher. If you don't, go back to Ch 1 and install Node.

(SCREENSHOT: PowerShell with the command node --version typed and the version printed — prompt cursor on the next line)

That's all for setup. The next unit puts code into script.js and runs it.

4. What you should be seeing

A new folder ch06 with one empty file script.js inside it. A terminal that prints a Node version number when you ask. Nothing more.

If node --version printed an error instead of a version, stop and fix that before unit 6.1. Every unit after this runs Node code.

5. Common stumbles

  • You expected to build a UI in this chapter. You won't. This is the language layer. Terminal output is fine for now. The UI layer is Ch 7.
  • You think Node is the "newer" or "better" JavaScript. It's not. It's the same language with a different set of built-in tools. The browser has alert and document. Node has fs and process. The language in between is identical.
  • You don't have Node installed. Go back to Ch 1.4 and install it now. Don't try to read the rest of this chapter without it — you'll miss the on-machine half of every unit.

6. You should know

1/22
Next