0
Problems
Whenever I use the ^2 exponent in Javascript, no matter what the base is, the answer is always 2. 100^2 = 2 5^2 = 2 1^2 = 2 Any ideas how/why this is happening?
5 Respostas
+ 1
^ is xor, 2^2 should be 0
https://www.w3schools.com/js/js_bitwise.asp
+ 7
is this what you're looking for?
Math.pow(5, 2)
+ 6
when I tried it inside an alert function I got 102
+ 2
or 5**2
0
Hmmm, I was so used to using ^ for exponents. Thanks for the help!