JS Sketchbooksee JavaScript think ✏️
← back to phase 0

0.3 — Your first conversation with the machine

Enough watching — time to actually talk to the machine. Your first real instruction is console.log, which means: “machine, print this in the console.”

The console is a little window where the machine can answer you back. Users never see it — it’s a workbench for people like you. Programmers use it constantly; testers practically live in it.

watch it happen
console.log("Hello!");
console.log("I am your computer");
console.log(2 + 3);
console.log("2 + 3");

On the right: the console, currently silent. On the left: a four-line program. Let’s run it and watch the conversation start.

the console(silence…)
under the hood

The deeper story, with the real names for things — this part is what turns “I saw it” into “I can explain it.”

Let’s name the parts of console.log("Hello!"); properly. console is a built-in toolbox the browser hands to every program. log is one specific tool inside it — the “print this” tool. The dot between them means “look inside.”

The parentheses ( ) mean “here’s what I’m handing you,” and the semicolon ; ends the instruction, like a full stop ends a sentence.

Text in quotes is called a string (a string of characters — you’ll formally meet it in Phase 1).

Something the machine must work out, like 2 + 3, is called an expression. Working it out is called evaluating. One rule worth underlining: expressions are always evaluated before they are used. That is why console.log(2 + 3) receives a finished 5, never the recipe.

And here is the empowering part: you already own this tool. On a computer, press F12 in your real browser (or right-click → Inspect) and open the Console tab. Type console.log("I’m talking to a machine") and press Enter. On an iPad there is no F12 — use the live console below instead; it is the same conversation. That console is part of the developer tools — DevTools. As an automation tester you will open it hundreds of times a week.

your turn

🖥️ Try the real thing

This little console is live. Type a real instruction and press run — for example console.log("I did it!") or console.log(7 * 6). Misspell it on purpose, too — see what the machine says.

⌨️ your first real program

Two lines of real JavaScript, written by you, actually executed. You command; the machine computes — with math the lesson never showed you.

requirements:

  • First line: print exactly Hello!
  • Second line: make the console show 42 — but you may not type 42 anywhere. Make the machine compute it: six times seven, using the * symbol (that’s how keyboards multiply).

when you press RUN, the console must show exactly:

Hello!
42

✏️ Quick check 1

What does console.log("Good morning") do?

✏️ Quick check 2

Type exactly what console.log(10 - 4) prints:

✏️ Quick check 3

Now the twin with quotes: type EXACTLY what console.log("10 - 4") prints — every character.

teach it back

🗣️ Now teach it back

Explain to a friend: what does console.log do, who sees it — and why do console.log(2 + 3) and console.log("2 + 3") print different things?

Write it as if your friend is sitting next to you. Saved to your journal — future-you will use these notes to teach others.

a few sentences, minimum — you’ve got this
to remember
console.log("…") = “machine, print this in the console.” Only developers and testers see it — F12 opens it.
Quotes mean literal text, copied exactly. No quotes means an expression, worked out first.
The machine always evaluates what’s inside parentheses BEFORE handing it over — a rule you’ll meet everywhere.