ES6 introduced a huge number of improvements to Javascript. It was the first major update to the language since 2009 and It was due to this that so many features were added.

ES6 can be thought of as a catch-up release. Going forward the ECMAScript releases will aim to be much smaller and regular. The current release is ES7.

ES7 introduces two new features to Javascript. These are the includes array method and the exponentiation operator. Let’s take a look at these new features in detail.

The includes Array method Array.prototype.includes works exactly the way you’d imagine. It takes an initial parameter and returns true or false if the given parameter is or isn’t present in the array.

The method can also take an optional second parameter which defines the index to start searching from. See Advanced Usage below.

Basic Usage

const arr = [1,2,3]

const foo = arr.includes(1)  
const bar = arr.includes('bar')

console.log(foo, bar) // true, false  

Advanced Usage

const arr = ['a','b','c','d','e']

const foo = arr.includes('a', 0)  // begins search for 'a' from first item  
const bar = arr.includes('b', 2)  // returns false as starts search at 'c'  
const baz = arr.includes('e', -1) // starts search at n item from end

console.log(foo, bar, baz) // true, false, true  

The Exponentiation Operator

The exponentiation operator is syntactic sugar for Math.pow.

const foo = 2 ** 2 // Math.pow(2,2)

console.log(foo) // 4  


We can all agree that the includes array method is super useful. The days of indexOf are gone. However, the most significant aspect of ES7 to me is it’s conciseness. There was no attempt to cram in a load of functionality just for the sake of it. The sheer bulk of ES6 lead to many developers becoming fatigued whilst trying to get a grasp of all the new languages features. Luckily that was a one off. In the upcoming ECMAScript versions we can expect similar incremental improvements. This will make it much easier for developers to pick up.

All ES7 features are currently available in both Babel and Typescript