Exponentiation operator

The exponentiation operator may come in handy when working with math. Let's use the formula to calculate the area of a circle as an example:

const area = 3.14 * r * r; 

We could also use the Math.pow function to write the same code:

const area = 3.14 * Math.pow(r, 2); 

ES2016 introduced **, where ** is designed to be the new exponentiation operator. We can calculate the area of a circle using the exponentiation operator as follows:

const area = 3.14 * (r ** 2); 
This example can be executed at  https://goo.gl/Z6dCFB.

ES2015+ also has some other functionalities; among them, we can list iterators, typed arrays, Set, Map, WeakSet, WeakMap, tail calls, for..of, Symbol, Array.prototype.includes, trailing commas, string padding, object static methods, and so on. We will cover some of these other functionalities in other chapters of this book.

You can check the list of all available JavaScript and ECMAScript functionalities at https://developer.mozilla.org/en-US/docs/Web/JavaScript.