When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!
If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer!

Hello! I’m trying to create a Rock, Paper, Scissors program. I’m having some difficulty on the last steps where you can get the messages of who one/lost to print (i.e if a computer plays ‘Scissors’ and I play ‘Rock,’ the console will print: You Won!) I created the code, but I’m not sure how to assign the [codebyte]thePlayer[/codebyte] and the [codebyte]theComputer[codebyte] functions to the [codebyte] getUserChoice, getComputerChoice[codebyte] parameters of the [codebyte]winner [codebyte] function without it giving an error. Thanks! https://www.codecademy.com/workspaces/63117aff7b93e12c7b9ed46e
console.log(thePlayer('Scissors'));
let theComputer = computerChoice => {
switch (Math.floor(Math.random(computerChoice) * 3)) {
case 0:
return 'Compuer: Rock';
break;
case 1:
return 'Computer: Paper';
break;
case 2:
return 'Computer: Scissors';
break;
}
}
console.log(theComputer(3));
let winner = (getUserChoice, getComputerChoice) => {
if(getUserChoice === 'Rock' && getComputerChoice === 'Scissors' || getUserChoice === 'Paper' && getComputerChoice === 'Rock' && getUserChoice === 'Scissors' && getComputerChoice === 'Paper') {
return 'You Win!';
} else{
return 'Computer Wins!'
} if(getUserChoice === getComputerChoice) {
return 'Draw!';
}
}
Hi Ajax,
Not sure if you have already resolved this or not. The key is to look at the error. In this case it is clearly showing you that you have a reference error:
/home/ccuser/script.js:1
console.log(thePlayer('Scissors'));
^
ReferenceError: thePlayer is not defined
The reference error indicates that you are trying to access a variable that in this case doesn’t exist. You could resolve this a number of ways. The simplest might be just assigning a value to thePlayer before attempting to log it to the console.
const thePlayer = 'Scissors';
console.log(thePlayer);