Black lives matter
Portrait Dr. Axel Rauschmayer
Dr. Axel Rauschmayer
Homepage | Twitter
Cover of book “JavaScript for impatient programmers”
Book, exercises, quizzes
(free to read online)
Cover of book “Deep JavaScript”
Book (50% free online)
Cover of book “Tackling TypeScript”
Book (first part free online)
Logo of newsletter “ news”
Newsletter (free)

The increasing pervasiveness of JavaScript – a few historic milestones

[2012-01-27] dev, javascript, jslang
(Ad, please don’t block)

Update 2012-07-20: O’Reilly has published my mini-ebook “The Past, Present, and Future of JavaScript”. It is free, but you have to enter a name and an email in the box at the right. This ebook can be considered an updated and extended version of this blog post.

JavaScript is used in more and more places. It started out as a scripting language for web content and has migrated to many areas. This post presents the historic milestones of this process. Note: The milestones are about things that changed the public perception of what JavaScript could be used for. Some of these milestones would not have been possible without prior work by others. For example: Mozilla’s contributions in advancing the state of JavaScript cannot be overestimated. The following are the milestones, in chronological order:

1995. The creation of JavaScript [1]
In the mid 1990s, the web consisted of static web pages and forms that could be submitted to make changes. It became obvious that more dynamic content would be nice to have. At that time, Java was supposed to be the foundation of such content. But Java clearly was too complex for web designers and Java applets were unwieldy and too far removed from HTML – they ran in a rectangle, poorly integrated with the surrounding content. Hence, JavaScript was created for people that were not experienced programmers and wanted to add a little interactivity to their web pages. For example, forms whose content could be checked without being sent to the server or buttons that change their appearance if the cursor hovers over them. JavaScript was also to be the glue that connects more powerful components programmed in Java. Obviously, this last idea never gained much traction, because Java in the browser never became popular.
2001. JSON – a JavaScript-based data exchange format [2]
In 2001, Douglas Crockford named and documented JSON (JavaScript Object Notation) – a Lisp-inspired idea to use JavaScript syntax to store data in text format. JSON uses JavaScript literals for objects, arrays, strings, numbers, and booleans to represent structured data. Example:
        "first": "Jane",
        "last": "Porter",
        "married": true,
        "born": 1890,
        "friends": [ "Tarzan", "Cheeta" ]
Over the years, JSON has become a popular lightweight alternative to XML, especially when structured data is to be represented and not markup. Naturally, JSON is easy to consume via JavaScript.
2005. Ajax – browser-based desktop-class applications
Ajax is a collection of technologies that brings a level of interactivity to web pages that rivals that of desktop applications. One impressive example of what can be achieved via Ajax was introduced in February 2005: Google Maps. You were able to pan and zoom over a map of the world, but only the content that was currently visible was downloaded to the browser. After Google Maps came out, Jesse James Garrett noticed that it shared certain traits with other interactive web sites. He called these traits Ajax, an acronym for Asynchronous JavaScript and XML. The two cornerstones of Ajax are: First, loading content asynchronously in the background (XMLHttpRequest, 1999, Internet Explorer 5). Second, dynamically updating the current page with the results, by manipulating the DOM (Document Object Model) of the browser (DHTML, 1997, Netscape 4 and Internet Explorer 4). That was a marked usability improvement from always performing complete page reloads.

Since the inception of Ajax, other data formats have become popular (JSON instead of XML), other protocols can be used (e.g. Web Sockets in addition to HTTP) and bi-directional communication is possible. But the basic techniques are still the same.

2005. CouchDB – a JavaScript-centric database
Roughly, CouchDB is a JSON database: You feed it JSON objects, without the need to specify a schema in advance. Additionally, you can define views and indexes via JavaScript functions that perform map/reduce operations. Hence, CouchDB is a very good fit for JavaScript, because you can directly work with native data. Compared to a relational database, there is no mapping-related impedance mismatch. Compared to an object database, you avoid many complications, because only data is stored, no behavior. CouchDB is just one of several similar “NoSQL” databases. Most of them have excellent JavaScript support.
2007. WebKit becomes the foundation of the mobile web
Based on prior work by KDE, WebKit is an HTML engine introduced by Apple in 2003. It was open-sourced in 2005. With the introduction of the iPhone in 2007, it became the foundation of the mobile web. WebKit is now the main engine for Android and the only engine for iOS and dominates the mobile market. That means that if you want to write a cross-platform mobile application then web technology is currently your best bet (unless you need features that are only available natively).
2008. V8 – JavaScript can be fast
When Google introduced its Chrome web browser, one of its highlights was a very fast JavaScript engine called V8. It changed the perception of JavaScript as being slow and led to a speed race with other browser vendors that we are still profiting from. V8 is open source and can be used as a stand-alone component whenever one needs a fast embedded language that is widely known.
2009. Node.js – JavaScript on the server
Node.js lets you implement servers that perform well under load. To do so, it uses event-driven I/O and JavaScript (via V8). The event-driven programming style is unusual: All server code is executed by working off jobs from a queue, in a single thread. You register a handler for requests. Each request is an event that adds a job to the queue that invokes the handler. When the handler processes the request, it performs mostly quick computations in JavaScript. Optionally, it can delegate more time-consuming work (such as querying a database) by adding library invocations to the job queue. The last arguments of such invocations are callbacks for handling the results, later on. Thus, the server code does not block while waiting for the results and Node.js can immediately process the next job in the queue, e.g. to handle a new request. Most library jobs are executed in a pool of threads external to the main thread. When they are done, they add callback invocations to the queue. Those invocations can be viewed as resuming the work of the original request handler. One advantage of this approach is that the number of threads will never explode, even under heavy load. And the server code stays simple while still achieving a fair amount of multi-threading, thanks to the external thread pool.

The appeal of Node.js for JavaScript programmers goes beyond being able to program in a familiar language; you get to use the same language on both client and server. That allows you to do clever things such as a fallback for browsers that don’t run (a sufficiently sophisticated version of) JavaScript: assemble the pages on the server – with the same code that you are using on JavaScript-enabled clients (examples: FunctionSource’s web server, Yahoo Cocktails). Node.js creator Ryan Dahl mentions the following reasons for choosing JavaScript:

  • Because it’s bare and does not come with I/O APIs [hence all of them are new and non-blocking].
  • Web developers use it already.
  • DOM API is event-based. Everyone is already used to running without threads and on an event loop. [Web developers are not scared of callbacks.]
It should be noted that Dahl chose JavaScript not because he was so fond of the language, but for technical reasons. That the V8 JavaScript engine was fast and readily available must also have been appealing. Dahl was able to build on prior work on event-driven servers and server-side JavaScript (in the form of the CommonJS project).
2009. Chrome OS – a web operating system [3]
Since Ajax, more and more applications that people use are running in the browser: social networking, email, games, etc. Add to that the fact that Chrome even has its own task manager and you can see that a browser is already an embedded operating system. Then you have to ask the question: What do you need the embedding operating system for? That is the motivation behind Chrome OS: Run just the browser, as an operating system. There are three advantages to using this approach: First, it allows you to get started quickly with a new operating system, because all of the user interface technology is already there (for lower levels, you’ll need to plunder something else, such as Android or Linux). Second, many developers already know how to program for your operating system. Third, for users of the system, there is nothing to install, new users can get started quickly. That’s a big plus for public installations such as internet cafes and schools.

The introduction of the mobile operating system webOS (which originated at Palm and is now at HP) predates the introduction of Chrome OS, but the “browser as OS” idea is more apparent with the latter (which is why it was chosen as a milestone). webOS is both less and more. Less, because it is very focused on cell phones and tablets. More, because it has Node.js built in, to let you implement services in JavaScript. Another, more recent, entry in the web operating system category is Mozilla’s Boot to Gecko (B2G). Its initial target are cell phones. The B2G website also mentions a benefit of web operating systems for the web: they advance the state of the art.

We also need a hill to take, in order to scope and focus our efforts. Recently we saw the pdf.js project [which renders PDFs via HTML5, without plugins] expose small gaps that needed filling in order for “HTML5” to be a superset of PDF. We want to take a bigger step now, and find the gaps that keep web developers from being able to build apps that are—in every way—the equals of native apps built for the iPhone, Android, and WP7.
2011. Windows 8 – JavaScript as a first-class desktop citizen [4]
When Microsoft introduced Windows 8, it surprised everyone with the operating system’s extensive integration of HTML5. HTML5 applications are first-class citizens in Windows 8, on par with those implemented via incumbent technologies such as .NET and C++. To demonstrate that point, Microsoft wrote several important Windows 8 applications in HTML5 (plus proprietary extensions), including the app store and the email app.
A few more uses for JavaScript: You can use it to write shell scripts [5], build native mobile apps (via PhoneGap), program for Gnome (whose GnomeShell is mostly written in JavaScript). Complementing JavaScript, the web platform is also becoming increasingly powerful:
  • Features for applications: Canvas for bitmap graphics (static or animated), WebGL for 3D graphics, etc.
  • Features for documents: SVG for vector graphics, MathML for typesetting math, etc.


It’s great to see how useful JavaScript has become over the years. Three recommendations if you would like to get started with it: Comments on this blog post are welcome: Did I miss a milestone? Do you agree with the ones I picked?


  1. JavaScript: how it all began
  2. JavaScript’s JSON API
  3. A few thoughts on Chromebooks and Chrome OS
  4. A Windows 8 keynote review by a JavaScript programmer and Apple user
  5. Write your shell scripts in JavaScript, via Node.js