Inside This Article

JavaScript is the most popular language on the web, and is the curriculum focus at Fullstack Academy – but it wasn’t always that way. Fullstack Academy instructor Gabriel Lebec walks us through the origins and coming-of-age of this language that now powers apps and robots, but that got its start more than 20 years ago with Netscape and Sun Microsystems. Once you’ve studied up on your history, stay tuned for part two of our JavaScript series on why beginners can benefit from learning JavaScript.

What is JavaScript & Where Did it Come From?

JavaScript is the de facto language of the internet. Its (in)famous origins are often reduced to "Brendan Eich created JavaScript for Netscape in ten days!" While true, that bit of lore is worth a closer look.

Context: Browsers Get Smart

In 1993, developer Marc Andreessen helped the National Center for Supercomputing Applications at the University of Illinois to launch Mosaic: a user-friendly, graphical web browser. The Internet was evolving from being a text-based realm of hobbyists to a multimedia universe for mainstream computer users.

Andreessen subsequently founded the private Mosaic Communications Corporation and published a commercial browser called Mosaic Navigator in 1994 (the name was changed to Netscape after settling a lawsuit.) Netscape Navigator was a hit and Netscape's stellar IPO set new records.

Microsoft's reply, Internet Explorer, loomed ominously on the horizon. Andreessen knew that Navigator would have to push new features to maintain dominance; web browsers needed to move beyond displaying static documents, and run truly interactive software.

Java vs JavaScript (Part I)

In 1995 Netscape brokered a deal with another Microsoft competitor, Sun Microsystems, which was debuting a major programming language, Java. Java borrows syntax from C / C++, but compiled Java bytecode is portable — it can run as-is on different operating systems. A user with both Navigator and the Java Virtual Machine installed could execute Java programs as standalone "applets,” contained within (but separated from) a web page.

Java's fenced-off nature meant that there was still a need for a "scripting" language to enhance the web page – animating drop-down menus, validating form entries, etc. Since Sun was positioning Java as the professional choice for complex embedded programs, this companion language was envisioned as a small approachable solution for designers and page authors. Crucially, it could be written directly inside of HTML documents and would be interpreted by the Navigator browser itself.

It was at this point in early 1995 that Brendan Eich was famously contracted by Netscape to design such a language on an extreme deadline. The requirements provided to Eich, and his decisions in fulfilling them, would end up having a disproportionately monumental effect on the nature of the web.

How JavaScript was Designed

Designing a language is a challenge, but also an opportunity. Programming languages can express old ideas in new ways, and popularize alternative approaches.

Influences

Eich had read Structure and Interpretation of Computer Programs, a landmark MIT textbook, featuring the language Scheme, which combines a minimalist feature set with surprising power and flexibility – it does a lot with little. In Scheme, procedures can work on and generate "ordinary" data (numbers, text, etc.), as well as work on and generate other procedures, a defining characteristic of functional programming.

Netscape recruited Eich to implement "Scheme for the browser," then gave him a contradictory stipulation: whatever he came up with had to "look like Java." Eich ultimately created a quick proof of concept using Java-based syntax to express Scheme-based capabilities. He then went on to incorporate, into this already unlikely combination, a unique style of object-oriented programming (OOP).

A Unique Language

In OOP, data and procedures are encapsulated together into "objects", which are typically defined via a hierarchy of abstract classes. Java is one of the most object-oriented languages in existence, with the concept of classes inextricably woven throughout. But OOP in Java has an all-encompassing and rigid flavor that Eich eschewed. He instead chose a unique style of OOP – a dynamic and relaxed prototypal inheritance system inspired by the language Self. Objects could be created at will and linked to other objects (called prototypes). This prototypal inheritance adds comparatively little syntax to a language, yet is capable of simulating classical or alternative inheritance patterns.

This new language combined:

Eich created a tool that satisfied requirements ("looks like Java," "small", "approachable") but had greater potential than perhaps anyone had anticipated. It was known internally as Mocha, renamed LiveScript and finally—though it bears little resemblance to Java—called JavaScript.

 

Why is JavaScript So Popular?

JavaScript was far from loved at first. Java developers viewed it as a lesser entity for non-engineers — "UI glue" with sparse tooling and a "weird" inheritance system – and designers and authors still struggled to manipulate page elements like form fields.

In spite of these issues, JavaScript took off quickly, and development of new tools and web page features outpaced the delivery of actual Java applets. Microsoft was compelled to reverse-engineer JavaScript support into Internet Explorer as "JScript" in 1996, but the attempt was imperfect, yielding various incompatibilities between JavaScript and JScript.

A New Name: ECMAScript

Netscape realized that for an interactive, dynamic web to succeed, JavaScript would have to be consistent across browsers, so they asked the Ecma International standards organization to codify the language. In 1997, the organization laid out the platform-agnostic specifications for "ECMAScript" (ES), the language commonly known as JavaScript.

In the decade to follow, ECMAScript went through a bevy of revisions and spinoffs. ES2 (1998) and ES3 (1999) brought a number of important features (such as “exceptions,” a standard way of handling errors in code), continuing the JavaScript shift from mere "scripting glue" toward a full-fledged language for applications.

Java vs JavaScript (Part II)

Java applets, meanwhile, were languishing:

In short, JavaScript was seamlessly integrated with the web, whereas Java was lumbering and often divorced from page content. Unexpectedly, instead of supporting Sun's juggernaut Java, Eich's little mashup was supplanting it.

Evolution of JavaScript

JS still lacked certain features that would normally be expected of a "big" language, though, so ECMAScript 4 sought to remedy that with myriad additions: Java-style classes and interfaces, static types with annotations, improved scoping and variable types, etc. Developers from Microsoft, Opera, Yahoo!, and Macromedia debated what direction JS should take, while spinoff languages like Macromedia's ActionScript for Flash added to the uncertainty. ES4 descended into development hell and was eventually abandoned.

Despite bumps in the road, JS was too entrenched and useful to go the way of increasingly irrelevant Java and Flash applets. In 2005 Jesse James Garrett helped spark a renaissance by popularizing AJAX, a set of techniques that enable JavaScript-powered websites to feel more like fast native apps. The JS scene exploded with new, powerful libraries like jQuery and MooTools which abstracted away browser inconsistencies and made it easier to apply design patterns. JS was becoming not only the de facto language of the web, but was now being used to construct desktop-style products like Gmail and Google Maps.

ES5 (a more modest update than the ill-fated ES4, and originally named ES3.1) was released in 2009, and the Ecma community once again piled on a wishlist of new JS features for ES6. This resulted in another protracted consensus process, spanning an interminable six years, and practically doubled the size of ECMAScript.

Constant Flux

By 2015, JS was an integral part of the web, the heart of cutting-edge browser applications. Development teams were pushing the envelope with a bevy of frameworks and techniques to fill gaps in JavaScript's capabilities, and the committee in charge of the Ecma standardization process recognized that the community was moving faster than a six-year release cycle could satisfy. A new system was needed.

The new system allows features to be proposed, researched, and ratified in parallel. Every year, Ecma releases whichever features are deemed ready. ES6 was officially published as ES2015, and since then, ES2016 and ES2017 have delivered only incremental changes, with continuous support from browser vendors.

 

Who Uses JavaScript?

Some might say of JavaScript that "it is better to be lucky than good." Starting out in the right place at the right time, it has grown to become one of the most used languages in the industry. In fact, the 2017 GitHub "Octoverse" report puts it at #1 most used, with a staggering 2.3 million GitHub repos (2.3 times as many as Python, the runner-up), while the NPM package registry, a major source of downloadable JS code, dwarfs the registries for other languages.

Advantages of JavaScript

This exponential growth, however, is not solely a function of being integrated into the web. Since its inception, JavaScript has beaten out Java, Flash, and other competitors because:

JS code can now be found in phone apps, robots, space agencies, and more.

Disadvantages of JavaScript

JS also has some well-known foibles:

But the community has vigorously addressed these issues with a vibrant ecosystem of code, documentation, and educational resources.

The foreseeable future of JavaScript looks bright.

Stay tuned for part two on why beginners can benefit from learning JavaScript.

Find out more and read Fullstack Academy reviews on Course Report. Check out the Fullstack Academy website.

About The Author

Gabriel lebec fullstack academy

Gabriel taught himself to code as a kid, then studied mathematics and studio art at college. He worked as a teacher, medical researcher, and freelance web designer for some years before attending Fullstack Academy in 2014. Gabriel has been an instructor at Fullstack Academy since 2015.

related posts