Javascript - Operator Exponentiation Operator **

Introduction

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.

Demo

let a = 2; 
let b = 3; //from  ww w.j  a v a 2  s .c o 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.