Full-stack .NET developer
Skilled full-stack developer unafraid of any technology. He began with C# backend and is now a TypeScript and serverless enthusiast. After work, he plays football and works out in a gym. His biggest dream is to own a vineyard.
In this blog post, I will tell you the history of JS, why it faced so much flak and finally, I will describe a few tools that will allow you to build a modern application using just a single programming language.
A huge milestone in JS history was the release of the V8 engine developed by Google. It is an open-source engine written in C++ that tremendously improved JS performance by providing Just in Time (JIT) compilation. That method basically compiles some parts of code during runtime which was a huge performance boost for JS interpretation in browsers.
At this time, JS could only run in web browsers so JS was used purely as a frontend language for creating interactive websites. Everything changed in 2009 when NodeJS was released. NodeJS is an open-source runtime environment for JS that uses V8. It allows you to run JS code on any machine that has NodeJS installed.
Knowing the crazy history of JS, we can discuss how it is used. In the introduction, I said that it is possible to build nearly every type of application using JS; in this section, I will present to you some use cases with examples of technologies to use for each one.
Frontend is the most well known use case for JS. There are dozens of frameworks out there that help you develop visible parts of your system - so many that it became a meme. My favourite example is a website that shows how many days have passed since the last framework was published.
Jokes aside, there are many great frameworks available, starting from the mainstream like React, Angular (TS) or Vue to less known ones like Aurelia. All these frameworks allow developers to build complex frontend applications with great UX and UI. What is more, there are many ready-to-use tools that help you develop your websites faster. To show you how many libraries and tools are out there, let’s take a look at npm. Npm is an online package repository that allows sharing JS code. Currently, there are over 1 million packages available. Of course, some of them are more useful than others but still there are plenty of options to choose from. There are module bundlers (e.g. Webpack), CSS frameworks (e.g. TailwindCSS) and ready UI components (e.g. datepickers, calendars, tables and much more). If you like to build applications from ready-made blocks, then JS is the way to go.
Nowadays, both web and mobile frontend can be created with JS frameworks. For example, thanks to React Native, it is possible to develop applications for Android and iOS. The name is not a coincidence, and React Native allows developers to reuse React components. The interface of React Native is the same as React; however, it does not operate on the DOM but with a native platform it runs on.
Another technology that allows the creation of mobile applications is PWA which stands for Progressive Web Applications. In PWA, developers use common web technologies like HTML and CSS to build an application. When such an application is released, the user can use it via browser and install it on a device. The main difference between traditional websites and PWAs is the fact that PWAs allow not only installation but can also work offline.
Since NodeJS came into play, JS stopped being a pure frontend language and started to get more and more attention in various other fields. Right now, it is possible to write your application’s API with JS and consume it on the frontend. The most well known server-side JS framework is ExpressJS, released in 2010. After that, many new frameworks were created: Koa - a backend framework developed by ExpressJS team, Meteor - a framework that allows to develop full stack applications and NestJS, which is written in TypeScript and follows Angular architecture.
If you need your application to be installed on a desktop, then JS also provides such a possibility. The most well known desktop framework is Electron. It allows developers to build desktop UI applications using HTML and CSS. Thanks to that, it is not necessary to have separate desktop teams that develop in different languages and, what is more, some of the styling components can be reused. Additionally, Electron is not the only tool to do that; as already mentioned, PWAs allow users to install applications on their desktops too.
Not only business applications can be built with JS. Nowadays, you can create games and even VR applications using JS. There is WebGL, which is a JS API for rendering 3D graphics in a web browser. If the name is somehow familiar to you, then you are right because it is based on OpenGL and provides a similar API. WebGL is a fairly low-level API that is a base layer for other higher-level libraries that allow developers to create games faster and easier. One such example is Pixis.JS, a fully fledged game engine that enables developers to create games and render them in a web browser.
Finally, there is A-Frame that provides an API to create VR applications that are rendered in web browsers. The core of A-Frame is an entity-component engine that wraps around three.js (a library that provides ready API over WebGL). It speeds up and simplifies building games and VR apps using WebGL. A-Frame supports all major headsets.
I already told you about business and entertainment usage of JS; however, there is more: scientific usage. It is possible to develop AI using JS with some cutting edge technologies. The traditional way to deal with machine learning is to use Python, and the most known library to build ML models is Tensorflow. In 2018 Google released Tensorflow for JS. Even before that, there was Brain.JS that enabled machine learning in browsers. Thanks to these, scientists can build, learn and test using browsers and easily share their projects with all users.
As you see, there are many possible applications of JS and the language itself has a pretty interesting history. In the next part of this post, I will say more about why JS is a language that can be used anywhere and I will tell you why many developers get chills when you ask them to use JS.