Podcasts

057 - 25 years of JavaScript

December 01, 2020

With JavaScript turning 25 years old this month, Jeremy Morgan provides a look back at the language's fascinating history.


If you enjoy this episode, please consider leaving a review on Apple Podcasts or wherever you listen.

Please send any questions or comments to podcast@pluralsight.com.

Transcript

[00:00:00.000]

Not a day goes by that you don't use JavaScript in some way. Millions of people around the world use it, and most people don't even know it. 11.7 million of those people are fully aware of its existence, as they develop in it every day. That's roughly the population of Cuba. JavaScript has gone from being a silly little scripting language with a marketing-driven name to a complex powerhouse of a tool. Through all of the changes in tech over the last 25 years, it's persisted. JavaScript finds its way into every bit of technology we use. So let's look back on 25 years of this amazing language. Join me for The History of JavaScript.

 

[00:00:49.023]

It was December 1995. The Macarena had just gone viral, before we had a term for these things. Seinfeld and Friends were the hit TV shows at the time. The first fully computer animated film, Toy Story, ruled the box office. And this new thing called the internet was really starting to take off. A website named Amazon had just sold its first book. A new site called eBay was just created to have auctions online. And a clever little scripting language named JavaScript was invented for these cool web browsers that people installed on their computers. Now it seems like lifetime ago. That year I graduated high school, which makes me feel a little old. That was a big year for tech, and it was the birth of JavaScript. Now the project initially standard off in May of 1995. While the web was taking off, a few companies were racing to create the web browser of choice. Netscape Communications Corporation was in the lead at this time. Their browser, Netscape Navigator, was the de facto browser to have on your Windows 95 PC at the time. Netscape was founded by some of the developers of the first web browser, and it created a quality product that worked well for millions of people. And though it may not seem like much today, at the time it was a cutting-edge product that turned HTML and images into flashy web pages. But the model back then was just that, HTML and images. It was a static document that the visitor just downloaded from a website and displayed. Netscape wanted something more dynamic, something that might change what the visitor sees based on their actions, and this is something we really take for granted today, but at the time it was a big leap and quite a technical challenge. Netscape envisioned some sort of simple scripting language included in the HTML that the browser would run and interact with user input. Now Java at the time was exploding in popularity, and Netscape was working on a deal to include it in the browser. However, Netscape had the foresight to know that asking web developers to build things in Java might be too big of an ask. Java was already big and complicated in 1995, and asking web designers to learn this language and system for small things on the web would likely be unsuccessful. 

 

[00:02:59.951]

Now HTML was successful because it was easy. It was readable English surrounded by tags, and developers built these awesome websites with it, partially because it didn't take years to learn. Netscape wanted to create a language that web designers, amateurs, and hobbyists could learn. The Java developers could build heavyweight Java components, and the scripting language would tie it all together, and they decided to call it Mocha. They told Brendan Eich to make something like Scheme for the browser. Eich was already an accomplished developer for Silicon Graphics and intended to implement Scheme itself into the browser. Scheme is a language similar to Lisp. It's a very minimal, fast language that seemed to fit the bill nicely. However, once hired, the powers that be at Netscape insisted the language syntax resemble Java. Eich then started to work on Mocha. Now Eich built the first version in about 10 days to have it ready for the Netscape 2.0 beta. It was pretty rough, but he continued refining it. In September, Netscape renamed it LiveScript, which was pretty appropriate for the intent of the language. It had much of the functionality of Scheme but with similar syntax to Java. It wasn't an immediate success, but developers were pretty excited about it. Then in December, Netscape announced an open, cross-platform object scripting language for the creation and customization of applications on enterprise networks and the internet. They decided to name it something that would confuse people for the next 25 years: JavaScript. It wasn't Java, but that was the hottest language at the time, and this was a bridge to Java applications. The popularity of Java had a big influence here as well, as it helped adoption long term. 

 

[00:04:41.155]

Now Netscape was a big browser in 1995, but it wasn't the only game in town. Microsoft just had a big hit with their new operating system, Windows 95. They created a browser for Windows 95 called Internet Explorer. Now many have criticized Microsoft for being a bit late to the party. Netscape had a mature browser based on Mosaic that was created 2 years earlier. They grew market share quickly. But Microsoft had the most popular operating system at the time, and they wanted to take advantage of that. So the browser wars had begun. Now Netscape had LiveScript, later renamed JavaScript, in the release version of their browser. Developers quickly began building neat interfaces and making their web pages dynamic. The way it worked was, developers inserted JavaScript into the HTML, and an interpreter in Netscape parsed and compiled the JavaScript code to run. Microsoft reverse engineered this interpreter to create their scripting language and name it Jscript. Microsoft released their official version of Jscript in 1996, along with a new technology called CSS, or Cascading Style Sheets. These could be used to bring better visuals to the plain gray-and-black HTML that was popular at the time. The competing technologies were different enough that developers had to create separate code for both browsers, and at some point you had to choose which browser to target. This led to logos that said things like "best viewed in Netscape," or "best viewed in Internet Explorer." This practice continued for years. Now you may have heard JavaScript referred to as ECMAScript, and the reason for this is, in 1996 Netscape submitted JavaScript to ECMA International, a technical standards organization. The idea behind this was to create some kind of standard that hopefully all browsers would adhere to with the language. This was another move that showed brilliant foresight on Netscape's part. They wanted to open up the language for anyone to use it. They wanted it to be free for developers to use it anywhere. Netscape worked with many other companies, including Sun Microsystems, Apple, IBM, and even Microsoft to create this specification. Netscape had JavaScript, Microsoft had Jscript, so the committee decided on ECMAScript for the name. That way, the standard wouldn't favor any particular company. It was an open language at that point. One of the interesting discussions was whether JavaScript is a scripting language or a programming language. So scripting languages are written in text and interpreted into machine code where they're used. Programming languages are also written in text, but they're compiled to machine code before the program is run. And JavaScript is arguably both of these things. If you want to see some more interesting discussions, there are many still happening today on the internet. The ECMA Technical Committee number 39 approved ECMA-256 as a standard. This happened just as the internet exploded in popularity. Interestingly, in 1996 Brendan Eich rewrote and refactored the JavaScript engine to fix many of the problems that come from developing a language in 10 days. He named that engine SpiderMonkey, which is still the name JavaScript engine in Firefox to this day, but we'll get to that. Eich stated, "I'm not proud, but I'm happy that I chose Scheme-ish first-class functions and Self-ish prototypes as the main ingredients. The Java influences, especially Y2K date bugs but also primitive versus object distinction were unfortunate."

 

[00:08:08.829]

In the late '90s, Jscript and SpiderMonkey were the top JavaScript engines. They weren't exactly compatible, which caused many headaches for developers, but the JavaScript engine had greatly improved in Netscape Navigator 3. One of the biggest advantages was meaningful error messages. And many things were stubbed out, or created without any real functionality added. The language would flesh out soon enough, but there were plenty of undocumented and unfinished functions in the engine. That didn't matter though because developers took to the language quickly and began building dynamic sites all over the internet. According to Netscape, in 1996 there were 175,000 Java applets and more than 300,000 JavaScript-enabled web pages on the internet. It had taken off quickly. Version 1 of the ECMAScript standard was released in 1997. Though the browser wars were still raging, both companies were committed to developing the same standard. At this time, Netscape was the leader in JavaScript engine development. They implemented features that are still being used in JavaScript today, and worked to make JavaScript easier and more useful for developers. In December of 1999, the third standard for ECMAScript arrived, and it was big. It added things like exceptions, regular expressions, built-in functions, and much better error handling. JavaScript was becoming a truly respected language to development websites with. But in the early 2000s, JavaScript development had slowed down. Emergence of bigger back-end engines were taking over. Things like Java, ASP, PHP, and Python web engines were taking hold, and there was an attitude that JavaScript was unsafe or just plain annoying. Now I was one of the people that disabled in my browser for a time, mostly because it would block annoying things like popups, alert dialogs, and animated status bars. Netscape navigator had also fallen out of favor. Netscape was acquired by AOL, and after declining popularity, there wasn't much focus put into the browser anymore. Internet Explorer had won the battle for the desktop. For a time, it seemed JavaScript would go down with it. 

 

[00:10:15.000]

And there was also this neat little thing called Flash. Created by a company called Macromedia, the Flash plugin made pages really dynamic. It could do everything JavaScript could do and more. At first it was a graphical animation plugin. In 2000, the introduction of ActionScript meant you could develop real applications with Flash. Of course, ActionScript was derived from JavaScript, but it was still an enormous boost for Flash developers. Web developers could play videos, create video games, and make rich, interactive websites, all from this plugin to the browser. It brought all of the power of a desktop application to the browser. This ushered in the era of RIAs, or rich internet applications. At the time, there was nothing you could do with HTML or JavaScript that even came close to Flash. Many folks in the tech industry proclaimed the death of JavaScript. For the first few years of the 2000s, it looked like that might be a reality. Then came Ajax, Asynchronous JavaScript and XML. Now this idea had been around for a while, but it really standard to gain traction in the early 2000s. Ajax decoupled the presentation layer from the data exchange layer in web pages, and that's a jargon-filled way to say that you could update a page with data without refreshing that page. At the time, if you made a change to an HTML page, it had to refresh. Being a beginning web developer at the time, I wrote all kinds of stuff that would either trigger or ask for a refresh, and you could have 10 different HTML pages to do a simple function. And this was no longer an issue with Ajax, because you could do things asynchronously. For example, you could enter a login name and a password into a form and submit it. The login information would be sent to a server, verified, and sent back to the browser and update the page without even refreshing. Very common today, but in 2003 or so, that was pretty groundbreaking. I was already involved in enterprise development at this time, and I gave one of my first tech talks at a meetup in Portland about Ajax. Now I knew very little about it, but I crafted a cool demo. At the end of it, there wasn't a single person in the room who didn't think that this was going to be the way forward. Enterprise folks were excited about it, hobbyists were excited, everyone was excited about it. I still remember someone from the meetup saying to me, soon all the browsers will catch up to this, and we'll be doing more with JavaScript than you can dream of with Flash. Now, whoever this person was they were absolutely right. This was a pivotal moment for JavaScript. The Ajax era had begun, and the idea caught on quickly with developers. The attitude went from "JavaScript is dead" to "JavaScript is just getting started" almost overnight. It was a renaissance period for JavaScript. 

 

[00:13:00.322]

Jesse James Garrett released a white paper coining the term Ajax and describing how the technologies would be used with JavaScript as the backbone. Garrett was best known at the time for cofounding Adaptive Path, a user experience strategy and design firm. He'd authored The Elements of User Experience for web design. Clearly user design was his focus, and this is where Ajax would really shine. While folks were building fun games and cool animations with Flash, the Ajax folks were trying to make web pages easier to use and more intuitive. Ajax caught the attention of some pretty big players, and a few things happened around the same time that drove its success. Remember Brendan Eich? He cofounded an open-source project named Mozilla in the late '90s and was still very active with JavaScript development, even after Netscape went away. Brendan continued his work with the old code base, and he helped create the Mozilla Foundation in 2003. There he had been working on Project Phoenix, a browser derived from the old Netscape browser. It was named after the mythical bird that rose from the ashes of its predecessor. This seemed very fitting for the project, but of course Phoenix was a name that was already embedded in the tech world at the time, so they decided to call the new browser Firefox. Firefox had some great features, including a popup blocker, tabbed browsing, and the ability to create extensions. The popup blocker may have been one of the biggest reasons for its success. At the time, that's where most developers were using JavaScript. They would create popup advertisements that would pop up and take over the whole screen. And while we see some of that today, it's nothing like it was in the early 2000s. An instant competitor to Internet Explorer, it grew in popularity. Another benefit of Firefox, it was fast, really fast, and it processed JavaScript fast and worked well with Ajax, a new technology for web pages with a slick new browser. Another thing that helped Ajax's success was attention from the big players. Google released its Gmail project in 2004. It featured full Ajax to make handling email smooth and easy, no refreshing, no opening up a new page for every email you click. They also released Google Maps with the same technology. It was groundbreaking. As the popularity of Gmail and Google Maps rose, so did Ajax and JavaScript. 

 

[00:15:23.359]

Mozilla soon joined ECMA International and started work on ECMAScript for XML standard. Mozilla worked directly with Macromedia to ensure the standard could apply to ActionScript and Flash as well. But this particular release, ECMAScript 4, was fraught with problems. It was an attempt to grow into programming in the large. No longer a simple scripting language, features were added to grow it into a larger-scale language. Things like classes, interfaces, and namespaces were introduced. Bindings and block scoping needed to be refactored. The list is quite long of the things to be added. Douglas Crockford was involved in the process and was a major influence over the JavaScript community. He'd expressed concerns about the language growing out of control. Infighting with the group began, and at one point Microsoft refused to take part in ES4 completely. The group managed to pull things together to prevent major legal problems, but ES4 could not move forward. Crockford proposed a smaller subset of features for ECMAScript called 3.1. The standards were split, and they even had two separate committees. Eventually, 4 could not be completed, and 3.1 was agreed to and set forth. Brendan Eich made the final call to focus efforts on 3.1. Those working on ActionScript, which was now an Adobe product, moved forward with many of the ES4 suggestions that they'd pushed for and included them in ActionScript 3. Now, ECMAScript 4 was scrapped, but they managed to pull together the ideas and make it work in ECMAScript 5. Old biases against the language disappeared quickly, and many smart people started working on building out JavaScript for large enterprise applications. For a short time, this meant writing out huge files with tons of functions to get things working. JavaScript had entered the realm of real software development. No longer a language to make text blink or create popups, it was now firmly embedded in the enterprise. John Resig, a developer and recent collect graduate, created a JavaScript library at BarCamp, which was an international conference focused on the web. In one of the workshops, he started a simple JavaScript library with commonly used functions to prevent repeating code, especially with Ajax. He called it jQuery. Now it's hard to overstate how much impact jQuery had on web development. It abstracted away many functions for Ajax and DOM manipulation. It was an instant hit, and it's still powering the web today, with an estimated 74.4% of all websites on the internet using it. jQuery pushed JavaScript into the forefront. Though it was a library of simple functions, it enabled developers to get creative without having to focus on low-level implementation of details in JavaScript. It was lightweight, and it was fast.

 

[00:18:11.586]

Soon after, many JavaScript libraries began to flourish, bringing Ajax and other interactive functionality to web pages. Soon, entire frameworks would emerge for this powerful, fun language. ECMAScript 5 was in effect, and it turned out to be a solid release of features. In 2009, they added strict mode to provide better error checking and created real language constructs like getters and setters and reflection. JSON, or JavaScript Object Notation format, was a file format created especially for communication with JavaScript. It was smaller, faster, and easier to read than XML. It improved the performance and capabilities of JavaScript-based programs, and it's still used to this day. Google released its Chrome web browser this year, along with the V8 JavaScript engine, which was far faster than Firefox or Internet Explorer. It worked especially well with Google applications such as Gmail and Maps. It soon became extremely popular. Now at this time, the prevailing pattern was JavaScript in the browser and something else on the back end. Things like PHP, ASP.NET, Python, Java, and more were powering back-end applications, and then JavaScript communicated with it. This model worked well, and it's still employed today, but there are some specific problems around it, mostly having to do with skills. A Java or .NET developer may not be as great at JavaScript, and vice-versa. In order to be fully proficient in back-end and front-end development, you'd have to learn a minimum of two languages. Now many developers did just this, and this gave rise to the term full-stack developer. If you could write software on the back end and JavaScript on the front end, you were considered full stack, though most people were still better on one side than the other. 

 

[00:19:56.779]

That pattern persisted, but around 2009, a developer named Ryan Dahl changed all of that. Now at the time, Apache was the most popular web server on the internet, followed by IIS. They used blocking processes, which mean simultaneous connections would drastically slow down the server. At the time of their inception, this made sense because web browsers would ask for an HTML page, the server would block the connection, and send the HTML page back. This exchange would go back and forth with entire files. However, as the web began to grow and Ajax grew in popularity, these servers were being overwhelmed with requests. Concurrent connections would slow them down or block people entirely. Ryan Dahl's answer to that was Node.js. Node used Google's V8 JavaScript engine, the same one used in Chrome, and had an event loop and a low-level API for input and output. Instead of blocking out a visitor while requests were filled, it handled multiple small requests with ease. And of course, the language used for Node.js was JavaScript. 

 

[00:21:00.136]

This meant big changes for JavaScript developers. Now we had a faster, non-blocking connection that could scale to massive traffic from asynchronous requests. Also, now JavaScript developers could build applications on the back end as well, making a JavaScript developer a true full-stack developer. This led to many advances in web development. In fact, we weren't calling them websites anymore, but web applications. They were true software applications through and through, all written in JavaScript. 

 

[00:21:32.156]

For years, JavaScript continued dominating the web. Google began work on a JavaScript framework to manage projects at Google named AngularJS. It was an opinionated framework, preferring declarative programming for interfaces and imperative programming in the business logic. It used two-way data binding to make templating of data easy and clean. It used an MVC, or model-view-controller architecture, and enabled developers to build structured, enterprise-quality applications. They released it to the public, and it gained popularity rapidly. After some significant rewrites, Google dropped the JS, naming it simply Angular, and it's now powered by TypeScript, which is eventually transpiled into JavaScript. It's among one of the stronger frameworks available today. Jordan Walke, a software engineer at Facebook, began work on a similar project. Now React.js is more of library than a framework. While an opinionated framework like Angular dictates how applications should be built, the React model works more like a library, where you can use what you need any way you like. React gained popularity quickly and created an entire ecosystem around itself. It addresses many of the problems associated with mobile development, enabling JavaScript developers to build applications for mobile platforms. It opens many new doors for JavaScript development.

 

[00:22:54.251]

Another developer who worked on AngularJS, Evan You, created Vue, a JavaScript framework that uses the MVVM pattern, or model-view-viewmodel. This framework is somewhat opinionated, but it also allows you to pick and choose what is used. The core library is the viewmodel, with other features being addons to the library. He's quoted as saying, "I figured, what if I what if I could just extract the part that I really liked about Angular and build something really lightweight." These three frameworks comprise the majority of applications you see today, though there are many efforts to build new ones. JavaScript has come a long way since being a simple scripting language based on Scheme for Netscape. Back then, JavaScript ran in a browser on a desktop PC with the Macarena playing in the background. As the tech world changed, JavaScript changed with it. Now we browse the internet on PCs, tablets, phones, and televisions. Even devices like sensors, cameras, and complex machinery communicate over the internet, and JavaScript is embedded in all of them. It's no longer a simple scripting language to connect things but a full, mature language in itself. The original intent to make it clean and easy to build for hobbyists has paid off over the years, as it was widely adopted and used by millions. JavaScript is now not only learner friendly but powerful and performs well. It will be exciting to see how it progresses in the next few years. ECMA is still heavily involved in improving and pushing JavaScript to the next level.

 

[00:24:32.030]

Thank you for listening to The History of JavaScript.