History

JavaScript Was Created in 10 Days: The 1995 Story and What Followed

Brendan Eich built the first JavaScript at Netscape in May 1995. See how a quick prototype became ECMAScript, AJAX, Node.js and the language of the web.

By Zebra Hosting Cloud

JavaScript runs in every web browser, and it is also used on servers, in mobile apps and in desktop software. It started as a quick project in May 1995 at Netscape Communications, when Brendan Eich was asked to create a scripting language for the Navigator browser. The widely told story is that he wrote the first prototype in about ten days. The language has changed enormously since, but some of its quirks come directly from that rush.

Why Netscape wanted a scripting language

In 1995, web pages were static. A page could contain text, images and links, and a form could be sent to a server, but nothing could happen in the browser without a round trip. Netscape wanted a lightweight language that designers and part-time programmers could use to make pages respond to the user, validate forms and control elements. Sun Microsystems' Java language was being promoted for the browser, but it was relatively heavy, and Netscape wanted a companion scripting language.

Eich had been hired to embed the Scheme language in the browser, and was given the chance to design a new language instead. Management wanted it to look something like Java. The result borrowed syntax from C and Java, ideas of functions as values from Scheme, and an object model based on prototypes from the Self language.

The names

Its first internal name was Mocha. It shipped in a Navigator 2.0 beta in September 1995 as LiveScript, and in December 1995 it was renamed JavaScript, as part of a marketing arrangement with Sun that promoted the two together. The name has caused confusion ever since. JavaScript and Java are different languages, with different designs and uses.

Standardising it

Microsoft built its own compatible implementation, called JScript, for Internet Explorer 3 in 1996. To avoid a split, Netscape submitted the language to Ecma International, a standards body. The standard, published in 1997, is called ECMAScript (ECMA-262), and JavaScript is the best-known implementation of it.

EditionYearNotes
ES11997First standard
ES31999Regular expressions, exceptions; the long-lived baseline
ES52009Strict mode, JSON support; ES4 was abandoned
ES2015 (ES6)2015Classes, modules, arrow functions, let and const; yearly releases since

From toy to platform

The dark years and AJAX

For a time JavaScript had a poor reputation, because it was used for pop-ups and annoying effects, and because browsers implemented it differently. A change came from a technique that allowed a page to request data from the server in the background and update part of the page without reloading. Microsoft had introduced the underlying object in Internet Explorer for its web email client. In 2005, Jesse James Garrett gave the approach a name, AJAX (Asynchronous JavaScript and XML), and applications such as Google Maps and Gmail showed what it made possible.

Libraries and fast engines

Libraries like jQuery (2006) smoothed over browser differences. Then the browser makers competed on speed. Google's V8 engine, released with Chrome in 2008, compiled JavaScript to machine code, and made it fast enough for serious applications.

Node.js

In 2009, Ryan Dahl released Node.js, which runs JavaScript outside the browser using V8. This let developers use one language on the front end and back end, and led to a large ecosystem of tools and packages, including the npm package manager.

The web as an application platform

Frameworks such as Angular, React and Vue, produced in the 2010s, allowed complex interfaces to be built in the browser. Today, JavaScript is also used with TypeScript, a typed superset created at Microsoft and released in 2012. The result is that much of what used to require a desktop program now runs as a website.

Practical points for site owners

  • Be careful with third-party scripts. Every script you add can slow the page and, if the source is compromised, can put your visitors at risk.
  • Do not rely on JavaScript for essentials. Core content and navigation should work even if a script fails.
  • Keep libraries updated. Old versions of popular libraries are a common source of vulnerabilities.
  • Respect privacy rules. Analytics and marketing scripts should load only after consent where the law requires it.

Quirks that came from the early design

Some features of the language still surprise newcomers. It converts values between types automatically, which produces results that look odd, such as comparisons that behave differently with two equal signs and three. Its this keyword depends on how a function is called, not where it is written. Early JavaScript also had global variables by default, which caused conflicts between scripts on the same page. Later editions added ways to avoid many of these problems, such as strict mode, block-scoped variables and modules, but the old behaviour had to remain because existing websites depended on it. This commitment to not breaking the web is why pages written decades ago generally still work.

The lesson for site owners

JavaScript shows how fast prototypes can become permanent infrastructure, which is a good reason to audit the scripts on your site from time to time. Remove what you don't need and update what you keep. A secure connection also matters for scripts, since pages that load code over plain HTTP can be tampered with. Every Zebra Hosting plan includes a free SSL certificate, and the security page explains more about how we protect hosted sites.