Rock, Paper, Scissors Project

I was trying to test run my code and it’s giving me an error saying userInput is not defined at the line where I log to the console. Any help would be appreciated, I’m sure I’m overlooking something simple.

const getUserChoice = userInput => {
  userInput = userInput.toLowerCase();
  if (userInput === 'rock' || userInput === 'paper' || userInput === 'scissors') {
    return userInput;
  } else {
    console.log('Error!')
  }
};

console.log(userInput('rock'));

Are you calling the function, or the parameter?

I’m trying to test “the function by calling it with valid and invalid input, and printing the results to the console.” as the instructions say

To repeat, are you calling the function or the parameter?

i think i am calling the function.

I figured out what my problem was. I wasn’t calling the function lol

1 Like