Help with Number Guesser

I’m stuck on the Number Guesser project.

Please review my code below and point out what’s wrong with it.
let humanScore = 0;

let computerScore = 0;

let currentRoundNumber = 1;

// Write your code below:

function generateTarget(targetNumber) {

let targetNumber = Math.floor(Math.random() * 10);

return targetNumber;


const compareGuesses = (humanGuess, computerGuess, targetGuess) => {

const humanDifference = Math.abs(targetGuess - humanGuess)

const computerDifference = Math.abs(targetGuess - computerGuess)

return humanDifference <= computerDifference;


function updateScore(winner) {

if (compareGuesses === true) {

    winner = 'human';

    humanScore += 1;


else {

    winner = 'computer';

    computerScore += 1;



function advanceRound(currentRoundNumber) {

currentRoundNumber += 1;


Thanks in advance!

Hello, @digital3437153042. Welcome to the forums.

If you’ll re-read instruction #5, and compare the instructions to how you wrote your updateScore() function, you should see the problem.

Keep in mind, that the main code for running the game is located in the game.js file. You are only asked to write a few functions that will be called by code in the game.js file. The arguments supplied to your functions come from those calls, and are out of your control unless you edit the game.js file which the exercise instructions advise strongly against. Your function needs only to take the argument passed to the winner parameter, and update the appropriate score variable.

Also, please review the guidelines here for guidance on how to have your code retain its original formatting when you share it in a post.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.