Hi, the prompt doesn't work. Any suggestions? If you could spell it out for me it would be helpful. I have only been doing this for less than a week Thanks!
Code:
<!DOCTYPE html>
<html>
<head>
<script>
function askUser(){
var playerSelection=prompt("Do you choose rock, paper or scissors?")}
askUser()
function computerPlay(){
let computerSelection = Math.random() *3;
if (computerSelection===0) {
computerSelection = "rock";
} else(computerSelection ===1); {
computerSelection = "scissors"
} else {computerSelection = "paper"
}
}
function singleRound(playerSelection, computerSelection)
playerSelection = playerSelection.toLowerCase()
if (playerSelection=="scissors" && computerSelection=="scissors") {
return "It's a tie!"}
else if
(playerSelection=="scissors" && computerSelection=="rock"){
return "Rock bests scissors"}
else if (playerSelection=="scissors" && computerSelection=="paper")
{return"You win. Scissors beats paper"}
else if
(playerSelection=="paper" && computerSelection=="scissors"){
return "I win. Scissors beats paper!"}
else if
(playerSelection=="paper"/i && computerSelection=="rock") {
return "You win! paper beats rock!"}
else if (playerSelection=="paper" && computerSelection=="paper")
{return "Paper and paper are a tie!"}
else if (playerSelection=="rock" && computerSelection=="paper"){
return "I win. Paper beats rock."}
else if (playerSelection=="rock" && computerSelection=="scissors"){
return "You win. Rock beats scissors."
}
else if (playerSelection=="rock" && computerSelection=="rock"){
return "Rock and rock is a tie."
}
</script>
</head>
<body>
</body>
</html>
Comment