# Number Guesser problem

This is for the Number Guesser project at the end of Javascript syntax 1. I can’t find any errors I have made in my code, and it isn’t spitting out syntax errors. However when I run the game it returns human as the winner for every round even when it shouldn’t. Have I made a logic error? I don’t want the example code given to me but I would like to know what I haven’t fully understood

let humanScore = 0;

let computerScore = 0;

let currentRoundNumber = 1;

const generateTarget = () => Math.floor(Math.random() * 10)

const compareGuesses = (human, computer, target) => {

let computerToTarget = computer - target

let humanToTarget = human - target

if (computerToTarget < 0) {

``````return computerToTarget *= -1
``````

}

if (humanToTarget < 0) {

``````return humanToTarget *= -1
``````

}

if (humanToTarget > computerToTarget) {

``````return false
``````

} else {

``````return true
``````

}

}

let winner = () => {

if (compareGuesses() === true) {

return ‘human’

} else if (compareGuesses() === false) {

return ‘computer’

}

}

const updateScore = winner => {

switch (winner) {

case ‘human’:

return humanScore++

break

case ‘computer’:

return computerScore++

break

}

}

currentRoundNumber++

}

Compare Guesses requires three arguments.

``````const compareGuesses = (human, computer, target)
``````

When called, it is given zero arguments.

``````let winner = () => {
if (compareGuesses() === true) {
return ‘human’
} else if (compareGuesses() === false) {
return ‘computer’
}
}
``````

`CompareGuesses()` doesn’t need those three arguments passed in since those variables are in the global scope. The code assumes as much.