What Is JavaScript and Why the Web Runs on It
A browser is a peculiar piece of software. It opens any address you type, downloads documents from servers it has never heard of, and then, without asking, r...
The One Language Every Browser Speaks
A browser is a peculiar piece of software. It opens any address you type, downloads documents from servers it has never heard of, and then, without asking, runs code those servers send. That third part — running untrusted code from strangers safely — is what makes the web different from every other software platform.
The language of that code is JavaScript. Not Python, not Java, not Rust. Every major browser — Chrome, Safari, Firefox, Edge, Brave — ships with a JavaScript engine baked into it. If you want code to run inside a browser tab, JavaScript is the only universal option. Everything else (TypeScript, CoffeeScript, ClojureScript, Elm) compiles down to JavaScript before the browser sees it.
This is not because JavaScript was the best language for the job. It is because Brendan Eich wrote it in ten days at Netscape in 1995, the standard locked in, and the network effect did the rest.
A Quick Mental Model
If you are coming from a Word document, think of a web page as having three layers stacked on top of each other:
- HTML — the structure. Headings, paragraphs, lists, images. The skeleton.
- CSS — the styling. Colors, spacing, fonts, layout. The skin.
- JavaScript — the behavior. Click handlers, animations, fetching new data, updating what the page shows. The muscles.
A page with only HTML and CSS is a brochure. Add JavaScript and it becomes an application. The "send" button on Gmail, the infinite scroll on Twitter, the live cursor in a Google Doc — all JavaScript.
What Code Looks Like
Here is the smallest interesting JavaScript program. It runs the moment a browser loads the page that contains it:
<button id="hello">Click me</button>
<script>
const button = document.getElementById('hello')
button.addEventListener('click', () => {
alert('Hi from JavaScript')
})
</script>
Three lines do real work. Find the button. Listen for clicks. When a click happens, show a popup. The browser provides the document, getElementById, addEventListener, and alert — those are not part of JavaScript itself. They are part of the browser environment the language runs inside.
This distinction matters. The same JavaScript engine runs on a server (via Node.js), and there document does not exist — there is no document. Instead you get fs (filesystem), http (server), and friends. Same language, different environment, different vocabulary.
Why It Won
JavaScript spread far beyond the browser for one reason that is easy to miss: it is the only language that runs everywhere a user already has installed software. You do not have to convince anyone to install Python or a JVM. If they have a browser, they have JavaScript.
Once you have a giant population of JavaScript developers and engines, two things follow:
- Server-side JavaScript becomes attractive (Node.js, Deno, Bun) so the same people can write both ends of a stack
- Tools that compile to JavaScript proliferate (TypeScript above all) because the JavaScript runtime is now the universal target
This is why you will hear "JavaScript everywhere" — not because the language is unusually good, but because the runtime is unusually portable.
What Is and Is Not in the Language
The actual JavaScript language is small. It has:
- Variables (
let,const) - Functions (regular and arrow)
- Objects and arrays
- Control flow (
if,for,while) - Asynchronous primitives (
Promise,async/await) - Modules (
import/export)
That is most of it. Everything else — the DOM, fetch, localStorage, setTimeout, even console.log — comes from the environment, not the language. When people complain that "JavaScript is huge," they are usually complaining about the environment plus the libraries, not the language.
The standardization body for the language itself is called TC39. They release a new version of the language each year (ES2015, ES2016, ..., ES2025). Engines update to support each new version on their own schedule, which is why "browser support" matters when you use a recent feature.
TypeScript: JavaScript With a Seatbelt
You will see TypeScript everywhere modern JavaScript is written. TypeScript is not a different language — it is JavaScript plus a type-checker that runs at compile time. Code like:
function add(a: number, b: number): number {
return a + b
}
Compiles to plain JavaScript before the browser sees it:
function add(a, b) {
return a + b
}
The types vanish at runtime. The benefit is the editor and the compiler can warn you when you are about to pass a string where a number is expected, before the code ever runs. For a junior developer this is a quiet superpower — most "weird bug" hours in JavaScript come from values being the wrong shape, and TypeScript catches a large fraction of those at the keystroke.
If you are starting today, learn JavaScript first. Once the patterns make sense, TypeScript is a one-week add-on, not a separate skill.
The Honest Trade-offs
JavaScript has well-known sharp edges:
- Loose equality.
==does coercion.0 == ''is true. Use===always; almost every team enforces it via a linter. thisbinding. Inside regular functions,thisis set by how the function is called, not where it is defined. Arrow functions fix this by inheritingthisfrom the surrounding scope. Use arrow functions for callbacks and you sidestep most of the trouble.- Dynamic typing. A variable can hold any type. Without TypeScript, refactoring is risky on anything beyond a small project.
- Async by default. Network calls, file I/O, timers — all asynchronous. You will spend a real amount of time learning Promises and
async/awaitbefore they feel natural.
These are not deal-breakers. Every working JavaScript engineer has internalized them. They are the kinds of things you stop noticing after a month of writing code.
Where to Start
If you have never written code:
- Open the browser developer tools on any page (Cmd+Opt+J on Mac, F12 on Windows).
- Go to the Console tab.
- Type
1 + 1and press Enter. The browser is now running JavaScript for you. - Type
document.titleand press Enter. The browser tells you the page title — that is the language reading the environment. - Type
document.body.style.background = 'lightblue'and press Enter. The page is now blue. You just changed a website with code.
Every web developer who is good at this started with that loop. There is nothing magical waiting after.
Where This Fits
The first lesson of the ABCsteps curriculum has you build a small browser game using AI assistance. The AI writes the JavaScript; you read it, run it, and modify it. You do not need to memorize the language to do that lesson — you need the mental model this article gave you. Browser runs JavaScript. JavaScript talks to the page through document. The rest is keystrokes.
The lesson will turn the keystrokes into reflexes.
Apply this hands-on · Module A
AI-Assisted Code: Your First App
Lesson 01 has you build a small browser game. JavaScript is the only language a browser runs natively — this article gives you the why before the lesson gives you the hands-on.
Open lesson