What is JavaScript?
JavaScript is the programming language of the web. It is what makes web pages interactive — buttons that do something when clicked, forms that validate as you type, content that updates without a full page reload, animations, games, chats, dashboards, drag-and-drop tools and entire single-page applications. If a website does more than show static text and images, JavaScript is almost certainly involved.
It started in 1995 as a small "scripting" language for the Netscape browser and has since grown into one of the most widely used languages in the world. Today JavaScript runs in every browser, on servers (Node.js, Deno, Bun), on mobile devices (React Native, Capacitor), on the desktop (Electron, Tauri), on embedded hardware and at the edge of cloud platforms.
A short, plain-English definition
JavaScript is a high-level, multi-paradigm, dynamically typed programming language with first-class functions, originally designed to run inside web browsers and now ubiquitous as a general-purpose language.
Unpacking that:
High-level — you write code in terms close to the problem (names, objects, functions), not CPU registers or memory addresses.
Multi-paradigm — you can write procedural, object-oriented, or functional code in the same file. JavaScript does not force one style.
Dynamically typed — variables don't have a fixed type. A variable that holds a number today can hold a string tomorrow.
First-class functions — functions are values: you can pass them as arguments, return them from other functions, store them in arrays or objects.
Designed for browsers, runs everywhere — its original home was a web page, but in the last decade it has become a general-purpose runtime.
What can you actually do with JavaScript?
Roughly, three big buckets:
On the page (front-end) — react to clicks, scrolls, key presses and form input; update the DOM without reloading; fetch data from a server; play audio, draw graphics, run games and simulations.
On the server (back-end) — answer HTTP requests, talk to databases, read and write files, send email, run scheduled jobs, build REST and GraphQL APIs. Node.js (and newer runtimes like Deno and Bun) made this possible.
Beyond the browser — desktop apps (VS Code, Discord, Slack, Figma all use JavaScript under the hood), mobile apps (Instagram and Facebook screens are partly React Native), edge compute (Cloudflare Workers, Vercel Functions), and embedded scripting for tools like Photoshop, Figma plugins, OBS, and even some IoT devices.
What makes JavaScript distinctive?
It runs everywhere a browser exists. No installation, no plugin — every modern device with a browser can execute JavaScript. That single fact is the reason the language took over the web.
It is single-threaded but asynchronous. A JavaScript program runs on one thread, but it has a built-in event loop that lets it wait for slow things (network, timers, user input) without blocking the page. Mastering this model is most of what makes a strong JavaScript developer.
Its functions are values. Closures, higher-order functions, partial application, currying — patterns that other languages added later are native here.
It is forgiving by default, strict on demand. You can write quick scripts without ceremony; you can also opt into strict mode, classes, types (TypeScript), bundlers and linters when you build something serious.
Its ecosystem is enormous. npm is the largest package registry in the world. You can find a library for almost anything in a few seconds.
A quick first taste
Here is a minimal program. Save it as index.html, open it in any browser, and you have run JavaScript.
index.html
<!DOCTYPE html>
<html lang="en">
<head><title>Hello</title></head>
<body>
<h1 id="greeting">…</h1>
<script>
const name = "World";
document.getElementById("greeting").textContent = "Hello, " + name + "!";
</script>
</body>
</html>When the browser loads this page it parses the HTML, finds the <script> tag, runs the JavaScript inside it, and the JavaScript reaches into the page and changes the heading text. That round trip — code → DOM → visible change — is the heart of front-end JavaScript.
JavaScript, ECMAScript, the DOM, and Node — what is what?
Beginners often hit a wall of confusing names. Here is the map:
ECMAScript is the formal language specification. Versions are named ES5, ES6 / ES2015, ES2016, … ES2024. When people say "ES6 features", they mean the features added in the 2015 edition (arrow functions, classes,
let/const, modules, etc.).JavaScript is the most common implementation of that specification — the one you write in your editor and the one your browser runs.
The DOM (Document Object Model) is not part of JavaScript itself. It is an API the browser provides so JavaScript can read and change the HTML page.
Node.js is a runtime that takes the V8 JavaScript engine out of Chrome and runs it as a stand-alone program — usable on a server or your laptop. Instead of the DOM, Node gives you APIs for files, sockets, processes and HTTP.
TypeScript is a superset of JavaScript that adds static types. It compiles down to plain JavaScript before running. It is optional, but increasingly popular for large codebases.
Why learn JavaScript?
It is the only language that runs natively in every web browser.
It is one of the most in-demand languages in the job market — front-end, back-end, full-stack, mobile and tooling roles all use it.
You can build real things in your first week — a calculator, a to-do list, a small game — without installing anything beyond a browser.
It opens the door to many adjacent skills: HTML and CSS for the page, Node.js for the server, React or Vue for UI, and TypeScript when you outgrow plain JavaScript.
The rest of this tutorial walks you through JavaScript from these first steps, through the language fundamentals, into the DOM and browser APIs, and on to the modern patterns and tools used in real codebases.