1

I know that we can use Math.pow() as a power function. However I'm making a calculator, and the user might type "^" to do the power function. Is there any way to use "^" as a power function? Or some things like ^() will also work.

Broccoliy
  • 19
  • 2

1 Answers1

2

Sorry, ^ means binary-exclusive-or in Javascript, and Javascript does not allow you to re-map operators.

(And you shouldn’t anyway. It would quickly become very confusing.)

Michael Lorton
  • 43,060
  • 26
  • 103
  • 144