Hi everyone:

Working on the Number Guesser project, and I have everything working correctly…except the score adds only to the computer’s score even when the user wins. I’m guessing it’s something wrong in the “if/else” statements in the compareGuesses function, but I’m honestly not sure. This is what I have for those code segments. Any advice is welcome.

compareGuesses = function(humanGuess, computerGuess, targetNumber) {

if (humanGuess === computerGuess) {

return true;

} else if (Math.abs(humanGuess - targetNumber) > Math.abs(computerGuess - targetNumber)) {

return false;

} else if (Math.abs(humanGuess - targetNumber) < Math.abs(computerGuess - targetNumber)) {

return true;

}

else {

return ‘Error, please try again.’;

}

};

const updateScore = () => {

if (compareGuesses === true) {

return humanScore++;

} else {

return computerScore++;

}

};