When we encounter new stuff, the reflex now is to search the web for answers. And more often we end up in Wikipedia for more detailed results and knowledge. In the case of JavaScript, you might end up with more questions than answers.
- - What is JavaScript?
- - Why is it so important?
- - Why we use JavaScript?
- - What’s coming for JS?
You will hear and read a lot that it is a client-side programming language, which is true but does not quite adequately gives it the merit it deserves today. We’ll come back to this later on. For now, let’s simply say that JavaScript is a tool that developers use to add interactivity to websites. Your browser needs three things to consume this content:
- HTML for structuring the content
- CSSfor styling it
- JavaScript makes it come to life!
The Journey
To understand where we’re at today and where we’re going, we first need to fully understand where we come from. For JavaScript, the story is a long and bumpy road. 1995 is where it all started - in the offices of Netscape where the first version of JavaScript was born. Take a moment to think about how different the web landscape was at that time. Most of you reading this were probably not even born. Netscape itself is a very distant memory today. At that moment though, Netscape’s Navigator was one of the most popular web browsers. It’s to support it that JavaScript was created, as a companion language to Java. The fact that Netscape wanted a language that would “look like Java” ruled out many other existing languages that could have been used to run the browser (Python, Tcl, Scheme, etc..). Back then, the web was fully-static, powered by simple HTML & CSS. JS brought dynamism.The initial goal with that new programming language was to make the web a full-blown application platform, meaning that JavaScript would run on both client and server. It was not a complete success though, as it took many years to be taken seriously as a backend language. But it rapidly thrived on the frontend, becoming the standard programming language of the web. Even after the death of Navigator, it was eventually adopted by all succeeding web browsers, from Explorer to Firefox and Chrome.
JavaScript was born in a hurry though, and various quirks would harm the language adoption in its early years. Still, some of its powerful features were part of it since its inception. These would define JS and allow it to grow. The next big step following the public release came with ECMA standardization, which became the “convention” behind JavaScript. It brought the language to a broader audience and allowed other potential implementors, like Microsoft, to have a say in its evolution.
Why does the web need it?
Up to this point, one question that might stick is - Why did Netscape need a whole new language for the web, wasn’t Java enough? The perception at that time was that Java was not suited for an entire audience that could potentially adopt web development such as scripters, amateurs & designers. It was just too big for the role. With the coming of JavaScript, it was possible to satisfy different audiences:- 1) component writers and enterprise-level professionals with Java
- 2) scripters & designers with JavaScript.
- Autocomplete
- Loading new content or data onto the page without reloading the page
- Rollover effects and dropdown menus
- Animating page elements such as fading, resizing or relocating
- Playing audio and video
- Validating input from forms - and a lot more
JavaScript is a scripting language that’s inserted directly in the HTML of a page. It’s the only programming language of this kind that can be understood by web browsers. Browsers can read Javascript, interpret it and then run the program, creating powerful client-side experiences. Since 2017, WebAssembly is also supported by modern browsers. It’s a new type of language that is designed to run alongside JavaScript.
It achieved this status because it’s open, standardized, and, most importantly, whether you agree or not, a very good language. It’s well-suited to the web with its dynamic nature and tight integration with theDOM. JavaScript is also compatible with other languages. This is super important as web servers run on different languages whether it’s PHP, Python, Ruby, Java or .NET. Because the JavaScript running in the browser is 100% decoupled from how HTML web pages are generated, users will always have the same rich experience as JS works, no matter the server-side language used. If you want to have a real feel, effect and influence JavaScript has on the web, try turning it off in your web browsers and see the result!
Why is JavaScript so important?
Even if JavaScript has been the language of the browsers for a long time, it hasn’t been that long since it got (almost) universal recognition from the development community. I mean, even Brendan Eich, considered the father of JavaScript, had pretty harsh words about JS back in 2008: Yet, here we are, more than ten years later and JavaScript is more present than ever before. I mean, it’s everywhere. It’s almost impossible to find your way around working with JavaScript in some way or another if you’re a developer.Why is that?
For answers, we need to look at the amazing ecosystem that was built on it. Some might sight the good old “chicken and egg” paradox here. Is it the power of JavaScript that allowed the creation of a thriving ecosystem, or that ecosystem that allowed JS to evolve and become a more viable language? We can also attribute the origin of this “JS revolution” to the release of ECMAScript 6 (or ECMAScript 2015). This update added new syntax for writing more complex applications and many other features that would define the next era of JavaScript. ECMAScript is a scripting-language specification standardized by Ecma International in ECMA-262 and ISO/IEC 16262. It was created to standardize JavaScript, so as to foster multiple independent implementations. JavaScript has remained the best-known implementation of ECMAScript since the standard was first published, with other well-known implementations including JScript and ActionScript (of Flash Fame - Adobe Implementation). ECMAScript is commonly used for client-side scripting on the World Wide Web, and it is increasingly being used for writing server applications and services using Node.js. Either way, this vibrant community and the rise of the web have taken JavaScript to a place it was never conceived to be.Language of the now powerful frontend
For a long time, websites were mostly powered by PHP-based CMSs, such as WordPress. Server-side code was handling the major part of the logic. Things are changing very rapidly. Modern browsers now have the capacity to make these interactive and fully-dynamic. A particularity they share with their ancestors, though, is the abstraction of backend development. Logic is handled client-side, directly in the browser, thanks to JavaScript.Modern web trends were born from this new paradigm, like the JAMstack. Some of the most prominent web applications around today are built using JS. Think Face-book, Gmail, Twitter, and many more. If we use Face-book as an example, JavaScript enables status updates and most user interactivity. It wouldn’t have much appeal without it. These tech giants actually built their own frameworks of JavaScript, and these now allow thousands of devs to build their own web apps. You might have heard of Angular, backed by Google, and React, backed by FB. And an upcoming rival Vue not supported by any of tech powerhouse, completes the triumvirate of important JS frameworks.
Other than reducing the amount of time and efforts required for developing JS-based sites and apps, these frameworks helped shape new web experiences. Take Single-Page Applications (SPA), for instance. A SPA is a website that interacts with users by dynamically rewriting a page in the browser rather than loading entire new pages from a server, making them behave more like desktop applications.