Exponentiation Operator in JavaScript



Exponentiation Operator

In JavaScript, arithmetic Exponentiation Operator is used to find the value of a number raised to power of another number.

Syntax

** symbol is used for arithmetic exponentiation operator.

Arithmetic exponentiation operator takes two values/variables as operands and returns the result of the left operand raised to the power of right operand.

a ** b  //a raised to the power of b
6 ** 4  //6 raised to the power of 4

Examples

1. Find the value of a raised to the power of b using exponentiation operator.

var a = 5;
var b = 4;

var result = a ** b;

console.log(result);