+ 1
Guessing game help (2): JS
I have another question / problem on this code. What I'm trying to do: When the var cS (computer score) or var uS (your score) = 5, this page appears to ask you If you want to "continue to 100", or reser (replay)". Problem: The function that tests If uS or cS Is 5 Isnt working. Function keepGoing: Line 172. I also have a function called continuePlaying towards the wnd of the JS code. https://code.sololearn.com/WScSKZg5SJB7/?ref=app
5 Respuestas
+ 2
Anthony Johnson Perfect. works.
Thanks!
+ 1
Anthony Johnson , I specifically it to be 50, but let's just do 5, to test if it actually works.
I don't want the screen to pop up every 5 score.
TEST:
If uS or cS is 5, the screen.appear.
+ 1
Anytime, nice work you've done. 👍🏻
0
Call your function keepGoing inside your else if statements where it determines who scored.
else if (uGuessInp.value == wN && uGuessInp.value != cGN){
res.innerHTML = "You score";
uS++;
uS = uS + 4;
uAS.innerHTML = uS;
urSC.style.animation = "scale 1s 1 forwards";
keepGoing();
}
else if(cGN == wN && uGuessInp.value != cGN){
res.innerHTML = "Computer score";
cS++ ;
cS = cS + 4;
cAS.innerHTML = cS;
keepGoing();
}
0
It will work. Just update your code how it is my previous post