0
Advanced math
I'm making a big calculator. I've already added PI and Square Root. But I want to add (x)^(2). JavaScript doesn't understand that and just sums them up. Do I need to make a function for it? function X2() { return x*x; } Or some kind of operator overloading? Please post an example.
1 Resposta
+ 4
Hi
Use Math.pow(x, 2) it will return what you need.