LESSON 1

What is JavaScript?

Learning objective: Understand what JavaScript is and what it adds to a web page.

Understand

JavaScript is the programming language that makes web pages interactive.

HTML gives structure and CSS gives style; JavaScript adds behaviour — responding to clicks, updating content, validating forms, and much more. It runs right in the browser.

Analogy: If HTML is the body and CSS is the appearance, JavaScript is the muscles that make things move.

See It in Action

A one-line greeting:

alert("Hello from JavaScript!");
How it works: alert() is a built-in function that pops up a message — proof that your JavaScript is running.

Try It Yourself

  1. Add a <script> tag to an HTML page.
  2. Put an alert() inside it.
  3. Open the page and see the popup.

Quick Quiz

What does JavaScript primarily add to a page?

Challenge

Make a page show an alert when it loads.

Success condition: Your page runs JavaScript and shows a message.