Why isn't this working properly
the output is wrong as an example, when computer brings out rock and the user paper it says it is a tie here's my code //Rock paper scissors is a classic two player game. Each player chooses either rock, paper or scissors. The items are compared, and whichever player chooses the more powerful item wins. // UserInput is defined based on user's decision var userInput = 'rock'; userInput = userInput.toLowerCase(); //TheComputerChoice give a number between one, two and three.Based on the outcome number, it returns rock, paper or scissors function getComputerChoice() { x = Math.floor(Math.random() * 2); if (x === 0) return 'rock'; else if (x === 1) return 'paper'; else if (x === 2) return 'scissors'; } // This function determines the winner by doing some simple math function determineWinner(userChoice,computerChoice) { if (userChoice === computerChoice) return 'tie'; else if (userChoice === 'rock' && computerChoice === 'paper') return 'computer won'; else if (userChoice === 'paper' && computerChoice === 'rock') return 'user won'; else if ( userChoice === 'scissors' && computerChoice === 'rock') return 'computer won'; else if ( userChoice === 'rock' && computerChoice === 'scissors') return 'user won'; else if ( userChoice === 'paper' && computerChoice === 'scissors') return 'computer won'; else if ( userChoice === 'scissors' && computerChoice === 'paper') return 'user won'; else if ( userChoice === 'bomb') return 'user won'; } // In this function. userChoice and computerChoice were defined in order to use console.logs function playGame() { var userChoice = userInput; var computerChoice = getComputerChoice(); console.log(determineWinner(userChoice,computerChoice)); } // the results are printed out console.log('userInput:' + userInput); console.log('getComputerChoice:' + getComputerChoice()); playGame();