Why is it only console logging, 'You lost, try again?'
Sun Aug 21 2022 14:42:27 GMT+0000 (Coordinated Universal Time)
Saved by
@Carminos
// 1. Get user's choice.
// USER: Rock 0; Paper 1; Scissors 2;
// COMPUTER: Rock 0; Paper 1; Scissors 2;
function getUserChoice(){
const choices = ['rock', 'paper', 'scissors'];
const userChoice = Math.floor(Math.random(choices) * 3);
console.log(userChoice);
}
getUserChoice();
// 2. Get computer's choice.
function getComputerChoice(){
const choices = ['rock', 'paper', 'scissors'];
const computerChoice = Math.floor(Math.random(choices) * 3);
console.log(computerChoice);
}
getComputerChoice();
content_copyCOPY
Comments