-1

can somebody explain me please what this line of code is actualy doing?

console.log(2 * 3 ** 4)

Thanks for help.

Čamo
  • 3,863
  • 13
  • 62
  • 114
  • 4
    Does this answer your question? [Is the double asterisk \*\* a valid JavaScript operator?](https://stackoverflow.com/questions/33284569/is-the-double-asterisk-a-valid-javascript-operator) – lusc Jun 23 '22 at 11:44

1 Answers1

0

The line console.log(2 * 3 ** 4); will produce the output: 162.

The ** works as exponent or power of the value. so 3**4 means 3x3x3x3 = 81. So 2*81 becomes 162.

user3470953
  • 11,025
  • 2
  • 17
  • 18