I was writing some calculations involving exponents in Javascript and due to my habit of using carets in Microsoft Excel, I typed x^2
in the code. It still gave me an answer but it wasn't what I wanted. What does ^
do in javascript?
alert(Math.pow(3,2)); //result is 9
alert(3^2); //result is 1