This question already has an answer here:
- The 3 different equals 5 answers
I am currently writing a JavaScript script to play Rock Paper Scissors in the console from the Odin Project. I have to take an input from a prompt & then run another function for the computer to pick Rock Paper or Scissors. The computerPlay function is working fine, but my problem is that the computerPlay function runs no matter what the input of the prompt field is. I am wondering how I can reference what the user inputs into the prompt. Note that this is not all of my code, just the relevant info.
My Code:
function playRound () {
let userInput = prompt ("Rock, Paper, or Scissors");
if (userInput = "Rock") {
computerPlay ();
}
}
playRound ();
Aucun commentaire:
Enregistrer un commentaire