Section 1 · What is JavaScript

The three languages of every web page

Before a single line of code — the big picture of who does what on a web page, and where JavaScript fits.

🎯 In one line: HTML is the structure, CSS is the styling, and JavaScript is the behaviour that reacts and changes things live.

1HTML, CSS, JS — the house analogy

LanguageJobHouse analogy
HTMLThe content & structure (headings, buttons, inputs)The walls & rooms
CSSThe look (colours, spacing, fonts)The paint & furniture
JavaScriptThe behaviour (clicks, changes, data)The electricity & plumbing — things that do stuff
🗣 Say it plainly When you click a "like" button and the count goes up without the page reloading — that's JavaScript. When a page loads more posts as you scroll — JavaScript. It's the language of interaction.

2Where does JavaScript run?

Two places, same language:

💡 One language, both sides of the web — that's a big part of why JavaScript is the most-used programming language in the world.

3🎬 Your first live JavaScript

This is a real JavaScript runner. console.log(...) prints a message to the output panel — it's how programmers peek at what their code is doing. Press Run (or Ctrl+Enter), then change the text and run again:

JavaScript · runs in your browser
Ctrl+Enter runs too
Try breaking it Delete a quote mark and run — you'll get a red error message. Reading errors is a real skill; they tell you what went wrong and roughly where. Nothing you do here can break anything.
🧠

Quick check

1. A button changes the page when clicked, with no reload. Which language is responsible?
JavaScript is the behaviour layer — reacting to clicks and changing the page live.
2. What does console.log("hi") do?
console.log is your window into what the code is doing — it prints values to the console.
3. JavaScript can run…
Same language, both sides: browsers (frontend) and Node.js (backend).
🔓 You're reading a free chapter of JavaScript — the first two are open.
Unlock the rest of this course with a one-time payment.
Unlock this course →
🔓 See course prices