ROck Paper Scissors
ROck Paper Scissors
userInput = userInput.toLowerCase();
function getComputerChoice() {
let randomChoice;
randomChoice = Math.floor(Math.random()*3);
return randomChoice;
function computerdecision(){
const printComputerChoice = getComputerChoice();
if (printComputerChoice === 0) {
return "rock";
} else if (printComputerChoice === 1) {
return "paper";
} else if (printComputerChoice === 2) {
return "scissors";
} else {
return "Incorrect Input";
}
}
function determineWinner(userChoice,computerChoice) {
if (userChoice === computerChoice) {
return "Tie";
}
if ( userChoice === "rock"){
if (computerChoice === "paper"){
return "Computer Won";
} else {
return "User Won";
}
}
function playGame () {
var userChoice = getUserChoice("bomb");
var computerChoice = computerdecision();
console.log(determineWinner(userChoice, computerChoice));
}
playGame();