function computerPlay(computerChoice) { computerChoice = ["rock", "paper", "scissors"]; randomComputerChoice = Math.floor(Math.random() * computerChoice.length); if (randomComputerChoice === 0) { return "rock"; } if (randomComputerChoice === 1) { return "paper"; } if (randomComputerChoice === 2) { return "scissors"; } return randomComputerChoice; } computerPlay(); // console.log(computerPlay()); function playRound(playerSelection, computerPlay) { // your code here! if (playerSelection.toLowerCase() === "rock" && computerPlay === "paper") { return `You Lose! ${computerPlay} beats ${playerSelection}`; } if ( playerSelection.toLowerCase() === "paper" && computerPlay === "scissors" ) { return `You Lose! ${computerPlay} beats ${playerSelection}`; } if (playerSelection.toLowerCase() === "scissors" && computerPlay === "rock") { return `You Lose! ${computerPlay} beats ${playerSelection}`; } if ( playerSelection.toLowerCase() === "scissors" && computerPlay === "paper" ) { return `You Win! ${playerSelection} beats ${computerPlay}`; } if (playerSelection.toLowerCase() === "paper" && computerPlay === "rock") { return `You Win! ${playerSelection} beats ${computerPlay}`; } if (playerSelection.toLowerCase() === "rock" && computerPlay === "scissors") { return `You Win! ${playerSelection} beats ${computerPlay}`; } if (playerSelection.toLowerCase() === "rock" && computerPlay === "rock") { return `You can redo! ${playerSelection} it's null ${computerPlay}`; } if ( playerSelection.toLowerCase() === "scissors" && computerPlay === "scissors" ) { return `You can redo! ${playerSelection} it's null ${computerPlay}`; } if (playerSelection.toLowerCase() === "paper" && computerPlay === "paper") { return `You can redo! ${playerSelection} it's null ${computerPlay}`; } } computerPlay(); function game(step) { let i = 1; do { const playerSelection = prompt(); const computerSelection = computerPlay(); console.log(playRound(playerSelection, computerSelection)); i++; } while (i <= step); } game(5);