The beginning of JavaScript: Brendan Eich and ten days in 1995

Published:

Almost every website you visit runs JavaScript, including this one. It is easy to forget that the language started as a rush job: a prototype written in roughly ten days in May 1995 by a single engineer at Netscape, Brendan Eich.

Netscape needed a language for the browser

In 1995 the web was mostly static pages. Netscape Navigator was the dominant browser, and the company wanted a lightweight scripting language that designers and part-time programmers could drop straight into HTML to make pages respond to the user, validating a form or reacting to a click, without a compile step.

Netscape had also just partnered with Sun Microsystems to bring Java to the browser. Java was meant for serious components built by professional programmers; the new scripting language would be its easy-going companion. Management had one firm requirement: it had to look like Java.

Brendan Eich and the ten-day prototype

Eich joined Netscape in April 1995. He had been hired with the idea of putting Scheme, a minimalist dialect of Lisp, in the browser, but the Java deal changed the brief. Working against a tight deadline, he wrote the first version of the language and its interpreter in about ten days that May.

The result was a blend of influences. The syntax, with its curly braces and semicolons, came from Java and C. First-class functions and closures came from Scheme. Objects that inherit directly from other objects through prototypes, instead of from classes, came from a research language called Self. Many of the quirks developers still joke about, such as loose type coercion, date handling borrowed from Java and the typeof null result, date back to that sprint.

Mocha, LiveScript, then JavaScript

The language was first called Mocha. It shipped as LiveScript in beta releases of Netscape Navigator 2.0 in September 1995. In December 1995 Netscape and Sun announced it as JavaScript, a name chosen largely for marketing, to ride the wave of excitement around Java. The two languages have little in common beyond the name and some surface syntax, and the confusion it caused has outlived both companies.

The browser wars and a standard

Microsoft reverse-engineered the language and shipped its own version, JScript, in Internet Explorer 3 in 1996. With two incompatible implementations in the market, Netscape handed the language to the standards body Ecma International in late 1996. The first edition of the ECMA-262 standard was published in June 1997 under the neutral name ECMAScript, because Sun, and later Oracle, owned the JavaScript trademark.

ECMAScript 3 followed in 1999 and became the baseline for the next decade. An ambitious fourth edition stalled over disagreements between browser makers and was abandoned in 2008, leading to the more modest ECMAScript 5 in 2009.

From toy language to the platform

For years JavaScript was treated as a toy for image rollovers and pop-up windows. That changed in the mid-2000s, when Gmail and Google Maps showed what a page could do by fetching data in the background, an approach Jesse James Garrett named Ajax in 2005. Google released Chrome with its fast V8 engine in 2008, and in 2009 Ryan Dahl built Node.js on top of V8, taking JavaScript out of the browser and onto servers.

ECMAScript 2015, often called ES6, was the biggest update since the start: classes, modules, arrow functions, let and const, promises and more. Since then the language has had a new edition every year. Today the same language runs web front ends, back-end services, build tooling, mobile apps and desktop apps.

What happened to Brendan Eich

Eich stayed at the centre of the browser world. In 1998 he helped found mozilla.org, the project that grew out of Netscape’s decision to open-source its browser code and later produced Firefox, and he served as Mozilla’s chief technology officer. He was briefly its CEO in 2014 before stepping down amid controversy, and in 2015 he co-founded Brave Software, maker of the Brave browser.

Why it still matters

JavaScript was never supposed to carry this much weight. It was designed in days, named for marketing and shaped by a browser war, yet it became the only language every browser runs natively. Knowing where it came from explains a lot of its oddities, and it is a good reminder that the tools that last are often the ones that shipped first and kept improving.