+ 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

12th Oct 2019, 7:21 PM
Ginfio
Ginfio - avatar
5 Respostas
+ 2
Anthony Johnson Perfect. works. Thanks!
13th Oct 2019, 4:41 AM
Ginfio
Ginfio - avatar
+ 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.
13th Oct 2019, 4:31 AM
Ginfio
Ginfio - avatar
+ 1
Anytime, nice work you've done. 👍🏻
13th Oct 2019, 4:42 AM
Anthony Johnson
Anthony Johnson - avatar
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(); }
13th Oct 2019, 2:58 AM
Anthony Johnson
Anthony Johnson - avatar
0
It will work. Just update your code how it is my previous post
13th Oct 2019, 4:34 AM
Anthony Johnson
Anthony Johnson - avatar