Why JavaScript is the Future of Programming Language

JavaScript was the first programming language I picked up. Well, I started with HTML and CSS, so just like so many other web developers, JavaScript was a no-brainer for me to go with, simply because it blends so well with HTML and CSS that it actually enhances your HTML/CSS skills as well. Today, JavaScript is one of the most powerful languages on the planet - because of its performance, and omnipresence.

Personally, I feel like JavaScript has the potential to tap into so many mature industries like Machine Learning and Data Analysis, where Python still rules the game, and it’s even happening with tools like Tensorflow.js! However this was definitely not the state of JavaScript before. Earlier, it was a weak, non-performant language and was frowned upon. JavaScript was for “losers”. But not anymore. Let’s see how JavaScript turned the tables in the last 10 years, why it has become stronger than ever, and why it is here to stay.

V8: A beast powering JavaScript

V8 is actually a JavaScript engine. What is a JavaScript engine, you might ask. A JavaScript engine is an interpreter which executes JavaScript code. A JavaScript engine can be implemented as a standard interpreter, or just-in-time (JIT) compiler that compiles JavaScript to bytecode in some form.

V8 is Google’s open source high-performance JavaScript and WebAssembly JIT engine, written in C++. It is used in Chrome and in Node.js, among others. V8 can run standalone, or can be embedded into any C++ application.

This is the piece of software which highly optimizes your JS code and converts it into machine code for the CPU to execute. Some of the tasks V8 do are:

  1. Garbage Collection
  2. Compilation to Machine code
  3. Inline caching
  4. Pointer compression
  5. and much much more optimization

As a matter of fact, pointer compression is a very new technique in V8 to boost memory optimization while having no effect on performance. If you’re a geeky, you can read more about how it is implemented on the official V8 blog.

The takeaway from this is that you can write JavaScript and sleep tight at night because your JS code is in very good hands to be optimized and converted into machine code by state of the art optimizations available.

Mature ecosystem and community

JavaScript, if not THE most mature, has one of the most mature ecosystems a programming language can ever have. The community for JavaScript is vast - and the entry barrier is extremely low. You can fire up a browser (found on 100% personal computers) - open console, and you’ll find a JS engine waiting for you to run code! This is never the case with any other programming languages of such complexity.

As if the vast community wasn’t enough, we have npm and yarn package systems. You name it, we have a package for that on npm registry - from creating random strings to handling streams and buffers in JavaScript - we have packages for easiest to toughest tasks. There’s a very famous saying among the JavaScript developers:

What can be done in JavaScript, would eventually be done in JavaScript

It’s funny, but lowkey I believe this. If you enter as a beginner, there is very little chance you encounter a problem which nobody has encountered before. This is because the permutations of doing mistakes with JavaScript is probably exhausted for simple issues - and have been long asked and archived on sites like stackoverflow.

Frameworks and libraries like React, Angular, Vue are paving the future of how applications should be built. They’re shifting the perspective towards declarative instead of imperative programming, the what instead of how - which lets developers develop quality applications without worrying about underlying high performant code.

Omnipresence

JavaScript is present on:

  1. Frontend (Browsers)
  2. Backend (Node, Deno)
  3. Android/iOS (React Native, NativeScript, etc.)
  4. Desktop (Electron)
  5. Hybrid (Ionic)

What makes this possible? JS engines like V8, are written in C/C++ and can even be compiled on embedded systems! For other platforms, because the browsers are always present (like on Andorid/iOS), they ship with a JS engine which can then be used smartly to be used for running any JS code, even for native apps - in case of React Native.

Bleeding edge features and advancement

JavaScript standard is led by ECMA-262 TC39 community, and man, are these people fast! ECMAScript releases a new standard of JavaScript, every single year (see the new ECMAScript2020 features!) and you as a developer can even request for new features in the language! For instance, see the bleeding edge features pending right now which might make it to JavaScript in some time!

You can find all the proposals here: TC39 Proposals

JavaScript is FAST and SCALABLE

Of course, nothing really beats C/C++/Rust, but JavaScript is a fast cheetah. Especially in front of its nearest competitors like Python. With the advancements in V8, it is becoming more performant and memory efficient.

JavaScript (Node) is highly scalable. Running on a single threaded architecture - people often criticize Node for it’s lack of threading environment. But that is where its strength lies. JavaScript leads the asynchronous event driven programming model of the industry, and does not need threads to scale. Instead, individual Node processes could be spawn to handle and utilize the complete CPU core. More on scaling Node later!

Conclusion

I love JavaScript, and using it, I’ve created a developer platform, for developers like you, to not only learn JavaScript, but various other languages like C, C++, Java, Node, Python, and more!

Originally published by Mehul Mohan at https://www.freecodecamp.org

#javascript #web-development #machine-learning

Why JavaScript is the Future of Programming Language
21.90 GEEK