Codecademy NumberGuesser JS question

Hi, I have been working through Codecademy's JavaScript lately. I just finished working on (and editing parts of) the Number Guesser Project. I have several questions about the Script.js file which I while link a GitHub repo to so you guys can reference:

https://github.com/TakingJester766/Codecademy-Number-Guess-Solution.git

A) Firstly, for the parameter “target” used in the functions CompGuess and HumanGuess, how are we calling that value to subtract from compNum and humanNum if “target” hasn’t been defined? I know that question sounds confusing but in essence, I don’t understand how we get “target” from the generateTarget function.

B) My second question is pretty similar to the first. How does the script go from finding whether HumanGuess <= CompGuess is true or not to using that to decide if winner===‘human’ or inner===‘computer’?

I’m sure these are pretty simple concepts, but I basically just do not understand how some of the values get transferred without necessarily being written explicitly. Sometimes, things just seem to transfer over without any reason behind them - it just looks too convenient sometimes. Thank you to anyone who sees and responds to this, I really appreciate it!

A: Here is the function I think you referred to in script.js:

function compareGuesses(humanNum,computerNum,target)
{
    let CompGuess=Math.abs(target-computerNum);
    let HumanGuess=Math.abs(target-humanNum);

    if (humanNum>9 || humanNum<0)
        alert('Please enter a number between 0 and 9.');
      
    if (HumanGuess<=CompGuess)
        return true;
    else
        return false;
    
} 

target is the 3rd parameter to the function so it will be defined as long as the function is called with 3 or more parameters. The 3 parameters are called humanNum, computerNum and target. It’s a bit confusing that the game.js also has a target variable but that is not what is used inside the above function due to scope rules. They just have the same name.

B: Before doing this comparison the function does this:

    let CompGuess=Math.abs(target-computerNum);
    let HumanGuess=Math.abs(target-humanNum);

So CompGuess will be the difference between target and computerNum (there is a subtraction). And we take the absolute of that difference to get a positive number (if it was negative). Those variables are named a little oddly and perhaps could have been named compTargetDiff or something like that since they represent how far from target the guess is.