How to write Mathematical formula with “^” (caret) in JavaScript?

前端 未结 4 622
Happy的楠姐
Happy的楠姐 2021-01-21 17:10

I need some help how to make this math formula in javascript. i have tried searching but couldn\'t really find cause i dont even know what ^ is called in English.

Thank

4条回答
  •  北恋
    北恋 (楼主)
    2021-01-21 17:32

    Math.pow() is what you are looking for.

    ^, as used in other languages, is called the power or exponential operator, but in Javascript, it serves a different purpose, it is the bitwise XOR operator.

提交回复
热议问题