A
A
Alucard7712018-10-22 20:34:59
JavaScript
Alucard771, 2018-10-22 20:34:59

Why doesn't the game end condition work?

I am writing a game for a test task.
How it should be: Two users enter the server, select one of the options, click on "Press if the choice is made!" and they receive an answer: if the result matches, then the alert "You won!" appears. for both players.
As it is in reality: players click the same result and nothing happens.
As I found out, due to the 'wait' event triggered above, a response does not come from the client that received it. If you remove this part of the code, then both messages come to the server.
But even in this case, the condition for victory does not work.
Why is that?
The code itself is here: https://repl.it/repls/PapayawhipRundownShell

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sobko, 2018-10-22
@Catzo0

Are you sure that in the if and else if conditions you want to perform an assignment (=) instead of an equality test (==, ===)?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question