Web & APIs

JavaScript · JS

/ JAH-vuh-script /

JavaScript is the programming language that makes web pages interactive. HTML gives a page its structure and CSS its looks, but JavaScript gives it behavior — it's what makes a button respond to a click, a form check itself, or a feed load more posts without reloading the whole page.

It runs right inside the browser, on the visitor's own computer. When you click 'like' and the heart fills in instantly, that's JavaScript reacting on the spot, quietly fetching and updating just the bit that changed instead of fetching a brand-new page.

Despite the name, it has nothing to do with the Java language — the resemblance is a 1990s marketing accident. These days JavaScript also runs outside the browser (on servers, in tools), but its home turf is, and always was, the page in front of you.

document.querySelector("button").addEventListener("click", () => {
  alert("You clicked it!");
});

Listen for a click on the button, then react — the heart of interactivity.

Much of what JavaScript does involves waiting — for a click, a server reply, a timer — so it leans heavily on async patterns to stay responsive while it waits.

Also called
jsecmascript