Can't figure out why my tie if statement wont work


#1

function getUserChoice(){
  var userInput=prompt('Rock, Paper, or Scissors?');
  userInput=userInput.toLowerCase();
  if(userInput==='rock'|| userInput==='paper'|| userInput==='scissors')
    return userInput;
  else{
    console.log('Error!');
  }
}
function getComputerChoice(){
  var randomNumber=Math.floor(Math.random()*3);
  switch(randomNumber){
    case 0:
      return 'rock';
    case 1:
      return 'paper';
    case 2:
      return 'scissors';
                     }
}
function determineWinner(){
  if( userChoice===computerChoice){
    return 'The Game is Tied';
  }
  if(userChoice==='rock'){
    if(computerChoice==='paper')
      return 'Computer wins this round';
    else{
      return 'Player Won this Game';
    }
  }
  if(userChoice==='paper'){
    if(computerChoice==='scissors'){
      return 'The Computer dominates this round';
    }else{
      return 'Player wins this round';
    }
  }
  if(userChoice==='scissors'){
    if(computerChoice==='paper'){
      return 'Player is Victoroius once again';
    }else{
      return 'The Computer owns the player once more';
    }
  }
}
function playGame(){
  var userChoice=getUserChoice();
  var computerChoice=getComputerChoice();
console.log('user picks= '+userChoice+' and the computer chooses '+computerChoice);
  console.log(determineWinner(userChoice, computerChoice));
}
playGame();

When i execute this code and they both userChoice and computerChoice equal each other it doesnt log it is a tie


#2

here:

function determineWinner()

your function has 0 parameters, yet when you call the function:

console.log(determineWinner(userChoice, computerChoice));

you supply 2 arguments to match the 0 parameters


#3

So in the funtion determinWinner() i want to add the parameters userChoice and computerChoice just like i did with the console.log?


#4

this seems to be the case, step 5 of the instructions:

Declare a function named determineWinner that takes two parameters named userChoice and computerChoice

i am just surprised the parameters have the same name as the global variables, but okay

the exercise tells you to use these parameter names, so stick with it