0

I am making a Whack a Mole like Zombie themed game in Javascript. I wanted to know the accuracy in percentages, like the hits vs missed ratio in percentages. So, i used this code:

let accuracy = (hit / (hit + missed)) * 100

This seems to work and give me the percentages. The only problem is that on the first click instead of showing 100, it shows 10. on rest of the clicks it shows the correct percentages for ex.50,60,75 etc. I have no idea why it shows 10 instaed of 100 on the first click.

Mr. Polywhirl
  • 42,981
  • 12
  • 84
  • 132
Mir
  • 5
  • 2

0 Answers0