Would Appreciate Some Help With "Score Keeper" Project


Hi, im working on a simple score keeper app and there are a few things that are not working as intended.

Here is my code:

  1. Whenever the “P1Span” and “P2Span” become equal to the value of the input field, the game does not end. I even tried using a double comparison operator but still nothing.

  2. Pressing the reset button only resets the input field back to its default value of 5 but does not reset the scores to 0.

  3. For some reason when changing the input value by clicking the arrows (fast), there is alot of lag and the change is not always reflected in the HTML.

If anyone has any input for any of these issues i would really appreciate it. Thank you!

  1. The if statements only runs once when first loading the app. Put them in a function and call the function when you want to check score. Check the types of your input value and Score variables one is a number, the other a string. You’ll have to use == or change their type before comparing.
1 === "1" // False
1 == "1" //True
  1. Reset only changes your score variables it doesn’t update the number in your spans.