Reputation: 29
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.
Upvotes: 2
Views: 98
Reputation: 44436
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.)
Upvotes: 3