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
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!');
});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.
JavaScript was originally designed to run inside a ____, but thanks to Node.js it can now run outside one too.
Which of these best describes the role of JavaScript on a web page, compared to HTML and CSS?
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 →