4. Exponentiation operator (**)
Table of contents
Please support this book: buy it (PDF, EPUB, MOBI) or donate
(Ad, please don’t block.)

4. Exponentiation operator (**)

The exponentiation operator (**) is an ECMAScript 2016 feature by Rick Waldron.

4.1 Overview

> 6 ** 2
36

4.2 An infix operator for exponentiation

** is an infix operator for exponentiation:

x ** y

produces the same result as

Math.pow(x, y)

Examples:

let squared = 3 ** 2; // 9

let num = 3;
num **= 2;
console.log(num); // 9

Further reading:

Next: III ECMAScript 2017