What is the output of following code?
console.log( 2 ** 10);
----o----
The output is 1024
.
Exponentiation operator(**
) calculates the power of a number. In the example the **
returns the 10th power of 2, ie 1024. This operator is the shorthand version of Math.pow()
.