Forum Discussion
ShannonConnor
4 years agoCommunity Member
Add square and square root buttons to an existing Javascript calculator built in SL 360
Hello! A few years ago I obtained a wonderful calculator from a fellow user on this forum. I now need to add a square button and square route button. I am not fluent with Javascript. I have attached...
ShannonConnor
4 years agoCommunity Member
Oh, thank you so much! The square root works perfectly. Square, however, does not. If I want the square root of 4, for example, which should be 16, it gives me 8. Instead of multiplying the number times itself (4x4), it is multiplying it times 2. I've tried to fix, but alas, I apparently am not quite grasping how to do so. Might I trouble you for your kindness a second time? Note that the x2 button was copied from another button, so the "s" is already in use. Perhaps using a "q" and the math.pow method might work?