javascript - How to stop the loop after same choices? -


My code looks something like this, but I have a problem. Whenever the options are the same, the game restarts. After finishing a game, I get an "undefined" warning, because the startGame () function again runs again with the first round parameter (where there were the same options).

I'm new to this word, and want to keep it as simple as possible. Can someone help me by providing a solution to stop 'undefined'? '

You use a recycling here. The StartGame () function resumes and the first call of the comparison () is expected of a return statement. You do not have any return statement.

  // If both choices are same (like 1 == like 2) {Warning ("Tie, restart the game!"); Start ();}  

You Instead of returning the result, you can solve the alert only with the statement. Here is a JSfield (comment of the function call):

Edit:

Another way is to return the message in all cases and the startGame () function is also a return statement. JSfield here (comment of function call):

< / Html>

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -