Number Guesser project

Hello,
I’m currently doing the number guesser project and am stuck in step 2.

I found an answer of someone who got it up and running, but I can’t seem to understand the logic.

This is the code:

let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;

// Write your code below:
//This will generate a random number 0-9
const generateTarget = number => {
    return Math.floor(Math.random() * 10);
};

const compareGuesses = (currentHumanGuess, computerGuess, target) => {
    if (Math.abs(currentHumanGuess - target) < Math.abs(computerGuess - target)) {
        return true;
    } else if (Math.abs(computerGuess - target) < Math.abs(currentHumanGuess - target)) {
        return false;
    } else {
        return true;
    }
};

In the declaration of compareGuesses variable, how do the parameters of the function within get filled? From where?

from the function call. Once you call the function, you need to provide arguments for your parameters. Go ahead and try to add a function call :slight_smile: