ES2016 feature: exponentiation operator (**)


The exponentiation operator (**) is an ECMAScript proposal by Rick Waldron. It is at stage 4 (finished) and part of ECMAScript 2016.



An infix operator for exponentiation

** is an infix operator for exponentiation:



x ** y

is 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:



Comments

Popular posts from this blog

Steve Lopez and the Importance of Newspapers

A Treasure Hunt Without The Treasure

Drop a ping-pong ball in the clown’s mouth