Free Lesson

What Is JavaScript?

JavaScript is the programming language that makes web pages interactive. HTML builds the page, CSS styles it, and JavaScript makes it respond when you click, type or scroll, and it runs in every web browser with nothing to install.

Brendan Eich created JavaScript in 10 days in 1995 at Netscape. Today it also runs servers, apps and games. Switch a page layer off below, then run your first line.

Interactive demo

JavaScript demo

HTML vs CSS vs JavaScript: switch a layer off

Think of a web page as a house. Turn each layer off to see what it was doing.

Page layers

Sunset Smoothie

Mango, peach and a squeeze of lime.

All three layers on: structure, style and behavior working together.

Run your first line of JavaScript

Pick a line, press Run and watch the page change. The effect is prepared ahead of time, so no code runs on your device.

script.js

document.querySelector("h3").textContent = "Hello, JavaScript!";

querySelector finds the heading on the page, and textContent swaps its words. No page reload needed.

My first web page

This card is the page your script.js controls.

Quick JavaScript quiz

Six questions on what JavaScript is and what it does.

  1. What is JavaScript?
  2. On a web page, which layer handles behavior like clicks?
  3. Is Java the same as JavaScript?
  4. What lets JavaScript run on a server?
  5. What does console.log("Hi") do?
  6. Do you need to install anything to try JavaScript?

Real world

What is JavaScript used for?

Interactive websites

Menus, image sliders, form checks, maps and live search. Almost every site you visit runs some JavaScript.

Examples: Gmail, Google Maps, YouTube

Servers with Node.js

Node.js runs JavaScript outside the browser, so the same language can power logins, APIs and databases.

Examples: Netflix, PayPal and LinkedIn back ends

Mobile and desktop apps

React Native builds phone apps and Electron builds desktop apps, both written in JavaScript.

Examples: VS Code, Slack, Discord

Browser games

Canvas and WebGL draw graphics right in the page, so games run with no download.

Examples: 2048, Wordle-style puzzles, Phaser games

Common mix-up

JavaScript vs Java

Different languages, similar names. Netscape renamed its new language from LiveScript to JavaScript in 1995 to ride Java's popularity. Java is compiled and mostly used for Android apps and large business systems. JavaScript runs in every browser and is the language of the web. As the saying goes: Java is to JavaScript as car is to carpet.

Get started

Is JavaScript hard to learn?

It is one of the easiest languages to start. You already have everything you need: a web browser. You see results instantly on a real page, which keeps practice fun. The tricky parts come later (asynchronous code, frameworks), and you can learn them one at a time.

A 4-week JavaScript starter path

  1. Week 1: The browser console

    Open your browser's developer tools (F12), try console.log, numbers, strings and variables with let and const.

  2. Week 2: Decisions and loops

    Learn if and else, comparison operators, and for loops. Build a tiny number guessing game in the console.

  3. Week 3: Functions and the DOM

    Write your own functions, then use querySelector and addEventListener to change a real HTML page.

  4. Week 4: A small real project

    Build a to-do list, a tip calculator or a quiz page with HTML, CSS and JavaScript, and share it online.

Learning JavaScript with AI?

Code Card turns your Claude Code, Codex, and OpenClaw sessions into a public developer profile with activity graphs, streaks, badges, and a shareable card, so you can track your coding progress. Start with npx code-card.

Make your Code Card

FAQ

JavaScript questions, answered

What is JavaScript in simple terms?

JavaScript is the programming language that makes web pages interactive. HTML builds the page, CSS styles it, and JavaScript makes it respond when you click, type or scroll. It runs in every web browser.

What is JavaScript used for?

JavaScript is used for interactive websites (menus, forms, maps), servers and APIs with Node.js, mobile apps with React Native, desktop apps with Electron, and browser games.

What is the difference between HTML, CSS and JavaScript?

HTML is the structure of a page (headings, text, buttons), CSS is the style (colors, fonts, layout) and JavaScript is the behavior (what happens when you interact). Most web pages use all three together.

Is JavaScript the same as Java?

No. Java and JavaScript are different languages. JavaScript was renamed in 1995 to ride Java's popularity. Java is mostly used for Android and large business systems, JavaScript for the web.

Is JavaScript hard to learn for beginners?

JavaScript is one of the most beginner-friendly languages because you can run it in any browser with no setup and see results instantly. Most beginners build a small interactive page within a few weeks of practice.