ecmascript21

What’s new with JavaScript in 2022 ?

JavaScript is a very popular development language. In this article, we will analyze why it is so popular. We will also talk about some new features in JavaScript following the new features introduced in the ECMAScript2021 standard. These new features allow to reduce the code size and to maximize its efficiency.

JavaScript’s increasing popularity

According to the study conducted by SlashData via its survey State of the Developer Nation, JavaScript is at the top of the ranking of the most used programming languages in the world. The latter has indeed gained more than 5 million followers in less than 3 years and now has more than 12.4 million users. JavaScript is ahead of Python with 9 million users, Java (8.2 million users), C/C++ (6.3 million users), PHP (6.1 million) and C# (6 million).

JavaScript can do virtually anything

JS is a very popular language because of its versatility. With it you can develop any part of the application development chain: Full Stack. You can use JS on any project on any platform. You can develop mobile applications via React Native, Capacitor or Cordova. The applications will have the native features of mobile devices (phone, tablets, etc.)

With ReactJS, VueJS or Angular frameworks, you can build quite advanced web applications. Most web pages on the net use JavaScript to make their content dynamic. Desktop applications are not left out with Electron. You can create software with it. With engines such as Unity, it is possible to create 2D or 3D video games with JavaScript. Famous software is developed in JavaScript, including Slack, Skype, Discord, Visual Studio Code, MailSpring, Atom. And finally, NodeJS is used for different scripts that can run on your PCs and servers.

JavaScript developer and the job market

JavaScript developers are in high demand. According to a study conducted by DevSkiller, nearly 70% of companies need a JavaScript developer. The latter can claim an annual income of more than 40K€ if he works in a company. He can also work as a freelancer with more flexible working hours.

What is the ECMAScript standard?

ECMAScript is a standard on which various programming languages such as JavaScript, ActionScript, JScript or TypeScript are based. It is also a language integrated into web browsers and used in application servers. The standard is standardized by the ECMA International organization. The first edition of the specifications was released in June 1997 and we are in the era of version 2021: ECMAScript21 which has just been approved.

What’s new in JavaScript

JavaScript developers should be aware of the new features supported by JavaScript following the specifications of the ECMAScript 2021 standard.
Let’s see some of these new features.

String.prototype.replaceAll()

ReplaceAll() now allows you to easily change a character or a string in a given document. This question has been asked many times on the forums for JavaScript developers for ages and JavaScript finally includes an easy solution.

Thus, instead of writing :

const test = “this-is-a-test!”;
test.replace(/-/g, “_”)

Or else

this-is-a-test!’.replace(/-/g, “_”)

You can directly write :

const test = “this-is-a-test!”;
test.replaceAll(“-“, “_”)

Or you can write

‘this-is-a-test!’.replaceAll(‘-‘, ‘_’);

Promise.any()

Promise already exists in JavaScript with 3 combinators: Promise.all(), Promise.race(), Promise.allSettled(). But ECMAScript21 introduces a last combiner: the Promise.any(). With the Promise.any() method, as soon as a promise is kept, it sends the value of the promise. If none of the promises are kept, the promise is broken with an AggregateError return, a new subclass of Error. Promise.any() does not behave like Promise.all(). The latter sends the values of all promises if and only if all promises in the iterable are fulfilled.

As an example, this code will send the value of promise2: “fast

const promise1 = Promise.reject(0);
const promise2 = new Promise((resolve) => setTimeout(resolve, 4000, ‘slow’));
const promise3 = new Promise((resolve) => setTimeout(resolve, 1000, ‘fast’));
const promises = [promise1, promise2, promise3];

Promise.any(promises).then((value) => console.log(value));

With Promise.all, the following code will display the values of the 3 promises after 6 seconds of waiting (after all the promises are kept)

const promise1 = new Promise((resolve) => setTimeout(resolve, 6000, ‘very slow’));
const promise2 = new Promise((resolve) => setTimeout(resolve, 4000, ‘slow’));
const promise3 = new Promise((resolve) => setTimeout(resolve, 1000, ‘fast’));
const promises = [promise1, promise2, promise3];

Promise.all(promises).then((value) => console.log(value));

The result would be :

(3)[“very slow”,”slow”,”fast”]

WeakRefs and Finalizers

Two new constructors have been introduced in the WeakRefs proposal. They are WeakRef and FinalizationRegistry. WeakRef or Weak References is used if we don’t want to keep an object in memory for a long time. So, if the program does not refer to the object, the memory will be freed. As for FinalizationRegistry, it is used to make callbacks once the object in memory has been collected.

Logical affection operators

You can combine the logical operators &&, ||, ?? with the assignment operator ‘=’. Thus, we can write

var x = 1;
var y = 2;
x &&= y;

or

var x = 1;
var y = 2;
if(x) {
x = y
}

And directly,

var x = 1;
var y = 2;
x &&= y;

Which will display “2”.

Numeric separators

It consists in introducing the hyphen under 8 (_) as a separator at the level of numbers. It can therefore be used as a separator of thousands to facilitate the reading of large numbers. Thus, this code will display “1500000”:

var separator = 1_500_000;
console.log(separator);

All in all, JavaScript is a very popular language and is not going to disappear any time soon. It is easy to learn and master. Knowing that with it, we can program almost anything, the career opportunities are real.

programming language

Which computer programming languages are trendy at the moment?

In the world of computer programming languages, diversity is the order of the day. There is at least one for every letter of the alphabet! As a beginner, developers are often at a loss when faced with the embarrassment of choice and have difficulty selecting the language that will propel their career. Depending on their interests or ambitions, it is essential to analyze the specific areas in which they wish to work to make an informed choice of the language that best suits them.

The evolution of computer programming languages follows that of the tools available on the web. Each new feature has its language. Procedural, functional or object-oriented programming, frameworks and libraries available or even ease of learning, each of these codes has its characteristics that give it a certain popularity among communities. And as for any language, the fashion is changing… Back to the computer languages that will be in the news in 2020.

The top computer programming languages of tomorrow

Lord of the computer programming languages, JavaScript has been at the top of the ranking for more than 7 years now. Historical and easy to learn, it benefits from an active community that produces numerous frameworks and libraries that are always more complete. The job of react developer in particular is a fashionable specialization that facilitates the creation of single-page web applications and is endorsed by the biggest names in the sector. We will come back to this.

PHP, despite its age, remains one of the darlings of developers. Its vast field of application and its simplicity of use make it one of the most commonly used interpreted scripting languages, notably thanks to its fast execution and foolproof stability. We can also mention Python, which is essential for those who want to work in the field of data science and artificial intelligence, or Swift, the native language that allows you to build IOS applications.

Choosing your language

Faced with the profusion of languages, it is necessary to select one’s own according to a central criterion: the field of application in which you wish to work. In the world of video games, C++ for PC games and C/C++ for consoles are part of the indispensable background to claim a position as a developer within a team. For the web, on the frontend, HTML/CSS and JavaScript remain essential to create a functional graphical interface.

PHP, Ruby or JavaScript (using NodeJS in particular) are the most used for data management for a website. Finally, for beginners, it is important to choose a language that will allow them to justify an attractive profile in the years to come. They should therefore always prefer a recent language (forget COBOL…) and one that can be useful in the expanding fields of artificial intelligence or mobile applications.

Becoming a React developer

Here, we will develop our article more specifically on a software library that could well become a favorite among developers in the years to come. React was created by Facebook in 2013 to allow developers to create single-page web applications. Its scope is only for the interface and it can be used with other libraries or frameworks like Agular for example. Its main asset is its flexibility, which makes the user’s experience more fluid by updating the browser only when necessary.

Chosen by Yahoo, Netflix, Airbnb or Sony to improve the performance of their sites, this free library encourages the creation and reuse of its components. In 2015, its versatility increases further with the release of React Native, a React-indexed framework that allows to create cross IOS and Android applications. Surely, everyone will be talking about React shortly!

microsoft GPT-3

This AI will be able to write programming code from natural language

Microsoft intends to open up application development to everyone, thanks to artificial intelligence. By integrating the GPT-3 linguistic model into its Power Apps, the firm allows the use of natural language to generate lines of code.

The Microsoft Build 2021 conference this week, aimed at developers, was an opportunity to discover the firm’s projects, such as the next generation of Windows. In his opening presentation, Satya Nadella, Microsoft’s CEO, also announced the use of artificial intelligence to assist in programming and allow a “no-code” approach.

This progress is made possible thanks to GPT-3, the largest linguistic model, capable of generating texts thanks to deep learning. GPT-3 is based on a neural network with 175 billion parameters, developed by OpenAI and based on the Transformer model. It will be integrated into Microsoft’s Power Apps to translate natural language into programming code.

Power Fx, a low-code programming language inspired by Excel

It is not about automatically generating entire programs, at least not at the moment. This new system allows to generate lines of code from a description of the desired action. The AI then proposes several possibilities, leaving it up to the user to choose the right one. Microsoft chose to associate it with the Power Fx programming language launched in March and inspired by Microsoft Excel. It is a “low-code” language, in other words, it allows you to create programs with little code.

The goal is to allow more people to create applications without having to master a programming language, and to address a growing shortage of developers. Microsoft has announced early access starting in June, in English only for users in North America.

online privacy

Why you need a VPN in 2020

VPN connections are by no means a new invention, but it is now that they are beginning to gain traction among the general public. While traditionally, their use was more common in the business environment, the great versatility of this type of connection, and their multiple applications make them increasingly popular.

But what is a VPN, and what advantages does it bring? That versatility we were talking about is the same that creates some confusion about it. As it is increasingly related to VPN connections with “evil” (with extensive quotes), as some of its applications include the leap of geographical blocks, greater anonymity in the network, or even blocking advertising.

What is a VPN?

Let’s start with the basics. VPN is the acronym for Virtual Private Network or virtual private network, which, unlike other more cryptic computer words such as DNS or HTTP, does give us quite precise clues as to what they consist of.

The keyword here is virtual because it is this property that generates the need for the VPN itself, as well as the one that allows VPN connections to offer you the multiple uses that we will see later.

To connect to the Internet, your mobile, PC, TV, and other devices generally communicate with the router or modem that connects your home to your Internet provider, either by cable or wirelessly. The components are different if you are using your mobile’s data connection (which includes its modem and talks to the telephone antenna). Still, the essence is the same: your device connects to another, which connects it to the Internet.

What are VPN connections for?

With the explanations above, you’ve probably already imagined a few situations in which VPN connections might be useful. It’s an open secret that they are especially crucial in the corporate environment, but their uses don’t end there at all. These are the primary uses of VPN connections.

Teleworking

The most apparent use of a VPN connection is interconnectivity in networks that are not physically connected, such as workers who are currently away from the office or companies with branches in several cities that need access to a single private network.

From a security point of view, allowing random access to a company’s network from the Internet is nothing short of insane. Even if access is password-protected, it could be captured at a public WiFi hotspot or sighted by a malicious observer.

Avoid censorship and geographic content blocks

With the heyday of the Internet and the picaresque of both content providers and users, other more playful uses of VPN connections have become popular, many of them related to a straightforward concept: misrepresenting where you are.

When you connect to a VPN, your device communicates with the VPN server, and it is the server that talks to the Internet. If you are in China and the VPN server is in the United States, generally, the web servers will believe that you are surfing from this country, allowing you to access the contents available only there, such as Netflix.

Similarly, this same logic can be used to access content that was censored or blocked in your country, but not where the VPN server is located. It is how millions of Chinese citizens manage to connect to Facebook and 3,000 other websites blocked in the country. This is best explained by this website Generation NT.

An extra layer of security

Although it is not strictly necessary, it is common for VPN connections to come with an encryption of the packets transmitted with them. It is normal to hear the recommendation that, if you need to connect to a public WiFi access point, at least use a VPN connection.

Logging in to your bank accounts while connected to a public WiFi network that you don’t trust is probably not the best idea in the world, as it’s relatively easy for a thief to capture packets unencrypted and get hold of your user accounts. It is where the extra layer of security that you can get through a VPN connection comes in, as the packets would be sent encrypted, so the listener probably couldn’t do anything with them.

P2P Downloads

Another everyday use of VPN connections is found in P2P downloads, which these days is generally synonymous with downloading from BitTorrent. Before you put a patch on my eye, a wooden leg, and force me to go through the keel, VPN connections also have used in P2P downloads even if you download completely legal torrents.

Unfortunately, it is common that Internet providers decide to stick their noses in how we send and receive zeros and ones on the Net. Although they love that we visit official web pages, that we download is not so funny: too much traffic, and you’re probably downloading something illegally.

Some providers completely block P2P downloads, while others boycott it to malfunction and give up on your own. Just as you can use a VPN connection to avoid censorship of your country, you can also sometimes prevent your ISP from boycotting your P2P downloads.

Advantages of VPN connections

Now that we know what a VPN connection is and what it’s for, it’s time to summarize a list of the advantages and disadvantages of using this technology. First, the positive side:

It works in all applications, because it routes all Internet traffic, unlike proxy servers, which you can only use in the web browser and a handful of other apps that let you configure the advanced connection options.

It connects and disconnects easily. Once configured, you can activate and deactivate the connection at will.

Additional security at WiFi access points, as long as the connection is encrypted, of course.

False of your location, as we have already seen in the previous section, a VPN connection is an effective way to avoid censorship or access content limited to a particular region.

Your Internet provider can’t know what you do on the Internet. Don’t you want your Internet provider to see that you spend hours watching videos of kittens on YouTube? With a VPN, they won’t know what you do, but be careful, the company that manages the VPN will.