What’s new in ES2016 (ES7)

It’s been a year since JavaScript started a faster release cycle of the new versions and now we’ve been presented with this brand new version called ES2016 or ES7.

In this article we will go through what’s new and what’s changed.

Photo by Artem Sapegin on Unsplash

Truth to be told, an answer to the question: “What’s new in ES6” is the same as to the question “What’s updog?”. Yes, it’s “Not much” 😂

Anyways, there is still progress, so let’s check that out:

Table of contents:

  • Array.prototype.includes()
  • Exponential operator

Array.prototype.includes()

This is very useful functions, when you want to check, if there is an item inside an array.

Up until now you could have used the syntax shown at the example below.

Example #1:

const items = [1, 2, 3, 4];
const theArrayDoesIncludeNumberFour = items.indexOf(4) !== -1;

Well, that is not going to be necessary and the new more prettier syntax will be as follows:

Example #2:

const items = [1, 2, 3, 4];
const theArrayDoesIncludeNumberFour = items.includes(4);

Exponential operator

In JavaScript, there it’s been possible to write variety of mathematical operations (addition, substraction, multiplication…) since its beginning.

Also, for quite a time it’s been possible to raise a number to the power of another, for example 2⁴ = 16 or Math.pow(2, 4) === 16.

From now on, it will be possible to use a new exponential operator ** in the following way:

Example #1:

2**4 === 16

Closing remarks

🙂 no guys, I am not joking, that’s it.

Don’t get me wrong, I am not thinking in disparaging way. Even though this major version of JavaScript update did not bring so much changes as the previous one, I think it’s because lots of people did not get used to the previous changes and are still not utilising them to their full power.

If you’d like to see, what changes in the previous version of JavaScript called ES2015 (ES6), you can check it out on this link.

And also if you liked this article, don’t forget to share it with people you like (or maybe also people you don’t like, maybe you’ll became friends! 😆 ).

I will be doing more articles like this in the future and if you want to get notified about them and everything else I release, subscribe to my newsletter right here.

Anyways, thanks for reading and I’ll see you in the next article! 🤓

Yours in coding,

Ivan