samedi 2 janvier 2021

Why is only my if , first else if, and else working? The rest of the else-ifs do not return [closed]

I want the code to say "Player receives 1 point" if they inputted "no" in the prompt. Or "Player receives 1 point" if they inputted "yes" but did not win.

I am attempting to make a simple game with Javascript. In the function, I have an if statement that will output depending on the answer to the prompt. I cannot figure out why the else-if statements are not working. Every time I roll the dice the either says "Player 2 Receives 2 Points", "Player 1 Receives 2 Points", or "No Points Received" even if both prompt answers are "no".

My original plan was to have the if statement with three conditions such as "'condition' && 'condition' && 'condition'" but that wouldn't call the function at all. That is the commented out area.

Thanks to anyone who can help.

If statement

The first attempt of the if conditions

Aucun commentaire:

Enregistrer un commentaire