Rock Paper Scissors - Javascript Notebook
A simple Javascript notebook made with Neil!
const choices = ["rock", "paper", "scissors"];
function playRound(playerChoice) {
const computerChoice = choices[Math.floor(Math.random() * 3)];
console.log(`You: ${playerChoice}, Computer: ${computerChoice}`);
if (playerChoice === computerChoice) return "It's a tie!";
if (
(playerChoice === "rock" && computerChoice === "scissors") ||
(playerChoice === "paper" && computerChoice === "rock") ||
(playerChoice === "scissors" && computerChoice === "paper")
) return "You win!";
return "You lose!";
}