Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

Understanding JavaScript · Lesson 1 of 15

What is JavaScript?

A free lesson from Swipe Coding · JavaScript, level 1 · updated October 2026

By the Swipe team, founded by Colin · how we make lessons

🤖
Buttons, forms, popups — almost everything that reacts on a webpage is JavaScript at work. Let's meet it. ⚡

JavaScript is a programming language that runs in every major web browser, making web pages interactive instead of just static documents. It's what lets a page respond when you click a button, validate a form before you submit it, update content without reloading, or pop up a menu — all the things that make a website feel alive.

The web is usually described as three layers working together: HTML provides the structure and content of a page, CSS controls how it looks (colors, layout, fonts), and JavaScript controls how it behaves. A page can exist with just HTML and CSS, but it would be completely static — nothing would happen when you interacted with it.

// JavaScript can react to what a user does
button.addEventListener('click', function () {
  alert('You clicked me!');
});
This snippet listens for a click and reacts immediately — the kind of behavior JavaScript adds to a page that HTML and CSS alone cannot.
🤖
Browser-only was just the beginning — Node.js blew that door wide open. 🚪

JavaScript was originally created to run only inside web browsers. But since 2009, a runtime called Node.js has let JavaScript run outside the browser too — on servers, in command-line tools, and even to build entire applications. That means learning JavaScript opens the door to far more than just web pages.

Fill in the blank

JavaScript was originally designed to run inside a ____, but thanks to Node.js it can now run outside one too.

Quick check

Which of these best describes the role of JavaScript on a web page, compared to HTML and CSS?

True or false

JavaScript can only run inside a web browser.

Today, JavaScript is one of the most widely used programming languages in the world. If a website does anything beyond just displaying text and images, there's a very good chance JavaScript is running behind the scenes to make it happen.

Keep your streak going in Swipe Coding

Swipe through every level of JavaScript on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.

Get the Swipe apps →