Javascript - Operator Exponentiation Operator **


The exponentiation operator is an arithmetic operator introduced in ES2016.

A double asterisk is used to calculate the exponent value of a number.

It is equivalent to the traditional pow() function of the Math library.


let a = 2; 
let b = 3; /*from  w ww  . j av  a2  s.  co m*/
a ** b               //8 
Math.pow(a, b)       // 8

Using the exponentiation Operator is a quick way to calculate the value when a number is raised to the corresponding power.