The history of JavaScript is, in many ways, the history of the modern Internet. Anyone who remembers the static, clunky, and slow-loading web pages of the early Internet—or even caught a glimpse of them via the Wayback Machine—has a sense of just how much web development has evolved since the 1990s. Interactive elements such as animation, fillable forms, and even the ability to scroll through articles like this one are largely due to the rise of JavaScript—a programming language that was initially developed in 10 days and conceived as a “sidekick” to Java.
Here at Azion, we are proud to announce JavaScript support for Edge Functions. To celebrate this exciting development, this post will take an in-depth look at just how far JavaScript has come by walking readers through the basic concepts, origins, standardization efforts, and current state of the world’s most popular programming language.
What is JavaScript?
JavaScript vs. HTML vs. CSS
JavaScript is a client-side scripting language that enables the creation of interactive elements on websites. Along with HTML and CSS, JavaScript provides one of the three building blocks that are used to create modern websites. A recent Hubspot blog post provides the following simple distinction for understanding the three concepts:
- HTML provides the basic structure of sites, which is enhanced and modified by other technologies like CSS and JavaScript.
- CSS is used to control presentation, formatting, and layout.
- JavaScript is used to control the behavior of different elements.
In other words, HTML provides the framework for a webpage, CSS adds design elements, and JavaScript enables interactivity.
What is JavaScript used for?
The coding website Skillcrush provides an excellent description of the uses for JavaScript. It notes that JavaScript is “used to create and control dynamic website content, i.e. anything that moves, refreshes, or otherwise changes on your screen without requiring you to manually reload a web page.” Among other interactive elements, this includes:
- confirmation boxes;
- slide in calls-to-action;
- browser-based games;
- animation and other special effects;
- security features such as passwords;
- automatically refreshing newsfeeds; and
- developing mobile applications.
Origins of JavaScript
Prehistory
JavaScript 1.0 was released in 1995, when the Internet was still a fairly new invention. The first web browser, Mosaic, had only been released two years ago, and HTML was the only tool for building websites (at the time, CSS was still a proposal, and would not be officially released until 1996). As such, creating websites was still a relatively easy skill to pick up, something that was accessible to not only software engineers, but inexperienced developers and designers.
Marc Andressen, the founder of the newly launched Netscape browser, wanted to expand the browser’s capabilities by adding more dynamic elements. At the same time, he wanted these elements to be available to the new and growing market of amateur web developers. As such, the idea was born to create a simple, dynamic scripting language that would one day be known as JavaScript.
Creation at Netscape
Brendan Eich, the creator of JavaScript, was contracted by Netscape to create a browser-based scripting language. According to JavaScript: The First Twenty Years, an ACM-published article co-authored by Eich, this task was complicated by Netscape’s partnership with Sun Microsystems. Their joint strategy was to integrate Sun’s Java programming language into Netscape 2.0 in a bid to overcome Microsoft’s Internet Explorer. As a result, “rapid strategizing inside Netscape to choose a scripting language severely handicapped Scheme, Perl, Python, Tcl, and Visual Basic as not viable due to business interests and/or time to market considerations. The only approach considered viable … was to design and implement a ‘little language’ to complement Java.”
As the beta of Netscape 2.0 was slated for release in September of 1995, Eich had to move quickly. The initial prototype—then deemed “Mocha”—was created in 10 days in May 1995, with further work over the summer to eliminate bugs, respond to feature requests, and design APIs that would allow Mocha to interact with Netscape. These APIs laid the groundwork for what would eventually be known as the Document Object Model (DOM), a key interface for interacting with HTML and XML documents.
As Auth0 notes in a 2017 blog post, the end result “looked like a dynamic Java, but underneath it was a very different beast: a premature lovechild of Scheme and Self” and was presented under the new name JavaScript “as a scripting language for small client-side tasks in the browser, while Java would be promoted as a bigger, professional tool to develop rich web components.”
Initial Release
JavaScript’s availability in the beta version of Netscape 2.0 was announced in a December 1995 press release, which described JavaScript as:
- designed for creating network-centric applications;
- complementary to and integrated with Java;
- complementary to and integrated with HTML; and
- open and cross-platform.
In the initial documentation, Netscape describes JavaScript’s key capabilities to “recognize and respond to user events such as mouse clicks, form input, and page navigation.” This enabled a wide range of use cases such as:
- requesting a user’s phone number or zip code;
- alerting users to invalid form entries;
- creating check boxes;
- adding “back” buttons to easily navigate websites;
- preserving state between webpages to track user actions; and
- playing animations, scrolling texts, or audio files.
ActiveX and NetscapeONE: Toward App Development
JScript and ActiveX
As interest in JavaScript grew, competing browsers like Internet Explorer were under pressure to enable similar scripting capabilities. Although “Java” was under trademark by Sun, JavaScript was open and freely licensed, enabling Microsoft to reverse-engineer its own implementation, JScript, which was released with Internet Explorer 3.0 in August 1996.
In addition, JScript could integrate with the wider Microsoft ecosystem as part of a suite of technologies known as ActiveX. As stated in a 1996 press release, ActiveX was intended to “form a robust framework for creating interactive content using software components, scripts and existing applications” and enabled users to “integrate applications into Web browsers so data managed by those applications becomes accessible as Web pages.” It also allowed for the creation of interactive applications on the server side via support for JScript as well as VBScript, a scripting language derived from Microsoft’s Visual Basic.
NetscapeONE and JavaScript 1.1
In addition to the popularity of JavaScript, a big impetus for Microsoft’s release of ActiveX was a similar project at Netscape designed to expand HTML beyond the browser and into the realm of web application development. This project, known as NetscapeONE, enabled web pages to not only present information, but serve as containers for business applications.
NetscapeONE, as well as Netscape 3.0, also included the 1.1 version of JavaScript, which enabled the creation of JavaScript libraries as separate pages rather than inserting JavaScript code into HTML files.
However, differences between Microsoft’s implementation of JavaScript and Netscape’s JavaScript 1.1 resulted in incompatibilities that caused interactive code to fail depending on the browser type or–at times–even the browser version. In order to truly enable cross-platform support, standardization was needed.
Standardization and Expansion
By creating specifications for how technological tools should be implemented, standards bodies enable interoperability across platforms and devices. Netscape announced its plans to standardize JavaScript through the international standards body ECMA in a 1996 press release. As ECMA could not use the trademarked name “Java”, the language was standardized under the name ECMAScript. The introduction of ECMAScript enabled more interoperability between browsers, but new developments in Internet history were driving demand for even more ambitious expansions.
One such development was the emergence of AJAX, a development technique that uses several technologies, including JavaScript, to enable asynchronous programming. With it, web pages could dynamically change content without reloading the entire page and, as a result, without disrupting the user experience. Although the initial 2005 blog post proposing AJAX primarily pitched it as a way to improve the user experience by reducing the time users are “waiting around for the server to do something,” its ramifications include many widely used features of the web today. This includes search suggestions that change as you type them into Google to status bars, notifications, newsfeeds, and other automatically updating elements.
Node.js and Server-side JavaScript
Over the course of the 2000s, the introduction and rapid growth of wireless Internet, Internet-connected mobile devices, cloud computing, and social media were driving Internet use to new heights, requiring more and more capacity to serve that traffic. In 2009, frustration with the inability of Apache HTTP servers to handle concurrent requests in the tens and hundreds of thousands inspired the creation of Node.js.
Node.js is a runtime environment that moves JavaScript out of the browser, enabling JavaScript to be run anywhere Node.js is installed by using Google’s V8 Engine to compile JavaScript code to machine code. As noted in JavaScript in Plain English, “this changed the JavaScript language forever and helped slowly turn it into more of a programming language and less of a scripting language” and enabling frontend developers to write server-side code without learning a new language. In addition, Node.js increases server capacity by using an event loop and asynchronous I/O to handle many concurrent requests at the same time.
JavaScript Today
Today, JavaScript is consistently rated as the most used programming language by web developers, according to GitHub. As of this year, W3Tech Surveys notes that JavaScript is used for client-side programming by 97.1% of all websites, including some of the world’s most popular websites such as Google, YouTube, Facebook, and Amazon.
The past few years have brought some of the most exciting developments in JavaScript to date, including the introduction of:
- Async and await, a JavaScript feature which simplifies the programming of asynchronous code;
- Webassembly, a complementary language to JavaScript which enables code written in different languages to run at near-native speed; and
- Typescript, a variant of JavaScript that checks a program for errors before execution.
Although JavaScript was designed quickly and intended for small front-end design tasks, it is now a rich and mature ecosystem which has transformed the modern Internet with dynamic sites and web applications.
Edge Functions with JavaScript Support
Here at Azion, one of our key goals is to make programming as simple and flexible as possible. That’s why JavaScript, a language with ubiquitous support and created with ease of use in mind, is a great fit for Edge Functions, a new product that brings serverless computing to the edge of the network.
Our implementation of JavaScript uses the ECMA Standard, including support for promises with async/await and plans to support WebAssembly soon. With Edge Functions, developers can build and run event-driven functions at the edge of the network, using the JavaScript Runtime API. Edge Functions execute in milliseconds on the edge node closest to their end user and scale automatically, eliminating the need to provision or manage resources. As a result, cost and resource use are dramatically reduced, and developers can spend more time focusing on their application’s front end, ensuring the best possible functionality and user experience.
To read more about Edge Functions, visit the product page or create a free account to start programming event-driven functions in JavaScript today.