PROGRAMMING LANGUAGES · EPISODE 4 OF 15 · 11 MIN ·

How did a language written in ten days end up running the web?

Almost every website runs some JavaScript. The survey firm W3Techs found it on 98.9 per cent of the websites it tracks, as of the seventh of October 2026. Yet the first version was put together in about ten days, in May 1995, as a sidekick to a bigger language. So how did a ten-day sidekick end up running the web?

▶ Watch on YouTubePlay the whole Programming Languages series ▶

The full story

The episode's narration, word for word. Numbers link to the sources below; timestamps play that moment.

The question 0:00

Almost every website runs some JavaScript 1. The survey firm W3Techs found it on 98.9 per cent of the websites it tracks, as of the seventh of October 2026 1. Yet the first version was put together in about ten days, in May 1995, as a sidekick to a bigger language 2. So how did a ten-day sidekick end up running the web?

Pages that just sat there 0:28

In 1995, a web page was mostly a document, written in HTML 2. Fill in a form, and the browser sent it off to a server, which sent back a whole new page 2. The page itself couldn't change without a trip to the server 2. Netscape, whose Navigator browser was then taking over the web, wanted page authors to glue a few lines of script straight into a page 2.

Ten days in May 0:55

Brendan Eich joined Netscape on the third of April 1995 2. He'd been recruited with a promise: come and put Scheme, an elegant research language, in the browser 2. Then Netscape struck a deal to ship Sun's new language, Java, and the brief changed 2. Management wanted a small, easy scripting language that looked like Java, and nothing like BASIC 2. Eich built a working prototype, code-named Mocha, in ten straight days in May 2. No record of the exact dates is known 2.

What ten days built 1:29

What did he actually build? First, a parser: a program that reads your code and works out its grammar 2. It turned the code into bytecode, a list of compact, numbered instructions 2. Then an interpreter, a loop that reads those instructions one at a time and carries each one out 2. Remember that interpreter. The history Eich co-wrote calls it simple and slow; speed wasn't a goal, because nobody expected big programs in it 2.

What it was for 2:01

Here's the sort of job it was made for. In early 1996, Eich guessed that the most common use was making pages a little smarter, like sending a click to a different link depending on the time of day 2. This little function, a named, reusable piece of code, is in that spirit. Give it the hour, nine o'clock, and it answers good morning. Code like this sat right inside the web page, and could run the moment someone clicked 2.

Ten days, with an asterisk 2:31

But ten days is only true of the prototype 2. Eich spent the northern summer wiring it into the browser, until the features were frozen in August 2. It first went public in September 1995, under the name LiveScript 2. The finished JavaScript 1.0 shipped in March 1996 2. Eich admitted at the time that it had been too much of a one-man show, and would contain numerous annoying little bugs 2.

A borrowed name 3:00

And the name? On the fourth of December 1995, Netscape and Sun announced it together as JavaScript, a companion to Java, endorsed by twenty-eight companies 2. That was a marketing link 2. The two languages looked a little alike on the surface, but underneath they were very different, and people have mixed them up ever since 2.

A copy, then a rulebook 3:24

Microsoft had to follow 2. Its Internet Explorer browser needed to run the same pages, so in 1996 it shipped its own copy, called JScript 2. With no proper specification, Microsoft's engineers ran test versions against thousands of websites, and reverse-engineered every difference from Netscape 2. So Netscape and Sun took the language to an international standards body, and the first standard came out in June 1997 2,3. Sun wouldn't hand over the name JavaScript, so the standard got a placeholder name, taken from the standards body's, and it stuck 2. Eich later said it sounds like a skin disease 2.

Strange results 4:09

Now for the quirks JavaScript is famous for. It quietly converts values from one type to another, which is called type coercion 2,4. Add the text five to the number one, and you get the text fifty-one 5. Subtract instead, and you get the number four 6. Ask what type null is, the value that means nothing, and it says object 7. And sort ten, nine and one, and you get one, ten, nine, because the default sort compares them as text 8.

Accidents and requests 4:42

Some of these were accidents. In the first engine, null was stored with the same internal tag as objects, so typeof reported object without anyone deciding it should 2,7. Others were requests. After the ten days, Netscape's own early users asked for the text four-oh-four to count as equal to the number four hundred and four, because web servers send their status codes as text 2. They also wanted an empty form field to count as zero 2. Handy in 1995 2. But the history Eich co-wrote says these conversions became a significant source of confusion and bugs 2.

Not JavaScript's fault 5:23

To be fair, one famous quirk isn't JavaScript's at all. Add nought point one and nought point two, and you get a tiny bit more than nought point three 9,10. Python gives exactly the same answer 10. Both store numbers in binary, in a standard format called IEEE 754, and most decimal fractions can't be written exactly in binary, just as one third can't be written exactly in decimal 9,10. Python's own documentation says it isn't a bug 10.

Don't break the web 5:56

So why not just fix them? A web page is stored as source code, and your browser reads and runs it fresh every time you visit 2. Many pages are never updated again 2. Change what old code means, and those pages break, and a browser that breaks sites loses users to one that doesn't 2,11. The 1996 website for the film Space Jam still worked, unchanged, twenty-two years later 11. A fix to make typeof null say null was proposed, and rejected 7.

SmooshGate 6:29

Even new features have to tiptoe. In 2018, a new way to flatten nested lists, called flatten, was tried in a test version of Firefox, and it broke at least one popular website 11. An old code library called MooTools had already added its own flatten, and the two collided 11. The proposal's author joked about renaming it smoosh, and some people believed it 11. In the end, it became flat 11.

Opting in 6:59

The fix is to let new code opt in. In 2009, the fifth edition of the standard added strict mode 2,3. You switch it on by putting the words use strict, in quotes, at the top 2,12. Older browsers see a harmless line of text and ignore it, so nothing breaks 2. Newer ones turn silent mistakes into errors 2. Misspell a variable name, and old JavaScript quietly creates a brand-new variable, while strict mode stops with an error 2,12. And three equals signs compare without converting, so the text four-oh-four no longer equals the number 4.

The long stall 7:39

Meanwhile, the browser wars ended 2. By June 2000, Netscape's share had fallen below fourteen per cent, and Internet Explorer went on to pass ninety 2. The next big edition of the standard was abandoned, never published 2,3. The main JavaScript engines' basic design stayed the same for about ten years 2. Then Google's Gmail and Google Maps showed that a page could fetch new data without reloading 2. In February 2005, Jesse James Garrett named the style Ajax 13. Suddenly the web wanted apps, and the old engines were too slow 2.

A farm in Denmark 8:19

In the northern autumn of 2006, Google hired Lars Bak to build a new JavaScript engine for its secret new browser 14. He and the first engineers worked in an outbuilding on his farm in Denmark 14. Chrome launched with V8 on the second of September 2008 14. One test at the time found it about ten times faster than Firefox's engine on Google's own benchmarks, though only about twice as fast on Apple's 2. Mozilla and Apple were building faster engines too 2. A new language feature that only one browser has is little use to anyone, so the browsers competed on speed instead 2.

How it got fast 9:01

So how does an engine like V8 make it fast? It starts the way Mocha did: your code becomes bytecode, and an interpreter runs it 2,15. But while it runs, V8 watches what really happens, like which types of value each line sees 15. Code that runs over and over is handed to an optimising compiler, which writes fast machine code for the chip, betting that those types will stay the same 15. That's just-in-time compiling, or JIT 15. Picture a cook translating a recipe line by line, who writes out a clean copy of the dish they make every night. Here's where that breaks: if the ingredients change, the copy is thrown away and it's back to line by line, which V8 calls deoptimising 15.

We timed it 9:51

We timed it ourselves. This loop adds up a hundred million small numbers. With V8's JIT compilers switched off, so everything runs in the interpreter, it was more than ten times slower on our test computer 16. But a tight loop like this is the best case for a JIT 15,16. On a benchmark built to resemble a typical web app, V8's own team found in 2019 that switching the JIT off made it only about forty per cent slower 16.

Shipped first, never replaced 10:22

So how did a ten-day language end up running the web? It shipped first, inside the browser most people used 2. Its rival had to copy it, and a standard locked it in 2,3. And because the web keeps so many old pages running, it couldn't be replaced, only added to and made faster 2,11. In Stack Overflow's 2026 survey, sixty-two per cent of respondents said they used it, the most used language for the twelfth year in a row 17. But all of this happened inside a browser. In 2009, a project called Node took V8 out of the browser 14. How did JavaScript escape the browser?

Sources

Every factual claim in the episode is tied to one of these. Spotted an error? Tell us.

  1. W3Techs: "Usage statistics of JavaScript as client-side programming language on… — w3techs.com
  2. A. Wirfs-Brock and B. Eich, "JavaScript: The First 20 Years", Proc. ACM Program. Lang.… — wirfs-brock.com
  3. Ecma International: "ECMA-262: ECMAScript 2026 language specification" (17th edition,… — ecma-international.org
  4. MDN Web Docs: "Equality (==)" — developer.mozilla.org
  5. MDN Web Docs: "Addition (+)" (string concatenation when one side is a string) — developer.mozilla.org
  6. MDN Web Docs: "Subtraction (-)" (coerces both operands to numbers) — developer.mozilla.org
  7. MDN Web Docs: "typeof" (typeof null) — developer.mozilla.org
  8. MDN Web Docs: "Array.prototype.sort()" — developer.mozilla.org
  9. MDN Web Docs: "Number" (IEEE 754 double precision) — developer.mozilla.org
  10. Python documentation: "Floating-Point Arithmetic: Issues and Limitations" — docs.python.org
  11. M. Bynens, "SmooshGate FAQ", Chrome for Developers blog (last updated 19 March 2018) — developer.chrome.com
  12. MDN Web Docs: "Strict mode" — developer.mozilla.org
  13. J. J. Garrett, "Ajax: A New Approach to Web Applications", Adaptive Path, 18 February… — web.archive.org
  14. V8 blog: "Celebrating 10 years of V8", 11 September 2018 — v8.dev
  15. V8 blog: "Maglev - V8's Fastest Optimizing JIT", 5 December 2023 — v8.dev
  16. V8 blog: "JIT-less V8", 13 March 2019 — v8.dev
  17. Stack Overflow: "Technology", Stack Overflow Developer Survey 2026 — survey.stackoverflow.co

Image credits

  • illustration (AI-generated), not the actual office
  • illustration (AI-generated), not the actual farm

Researched and scripted with AI assistance, fact-checked claim by claim, with synthetic narration and diagrams drawn in code. How we make episodes.

More from Programming Languages