Is the double asterisk ** a valid JavaScript operator?

后端 未结 3 598
我寻月下人不归
我寻月下人不归 2021-01-03 17:52

I solved a kata on CodeWars and was looking through some of the other solutions when I came across the double asterisk to signify to the power of. I have done some research

3条回答
  •  粉色の甜心
    2021-01-03 18:09

    ** was introduced in ECMAScript 2016 (ES7). But keep in mind that not all javascripts environments implements it (for instance, Internet Explorer does not support it).

    If you want to be cross browser, you have to use Math.pow.

    Math.pow(4, 5)
    

提交回复
热议问题