In the code below inside the compareGuesses() function we are calculating the distance between target and computerGuess & the distance between target and humanGuess and depending on which one is closer to the target number they will win. My question is how does javaScript know that the parameter ‘target’ is the same number as the function generateTarget()? The reason I ask the question is because we are not directly passing an argument through the target parameter. How are they linked?

let humanScore = 0;

let computerScore = 0;

let currentRoundNumber = 1;

// Write your code below:

function generateTarget(){

return Math.floor(Math.random() * 10);

}

const getAbsoluteDistance = (num)

function compareGuesses(humanGuess, computerGuess, target){

const computerG = Math.abs(target - computerGuess);

const userG = Math.abs(target - humanGuess);

return userG <= computerG;

}

let updateScore = (win) => {

if(win === ‘human’){

humanScore += 1;

} else{

computerScore += 1;

}

}

let advanceRound = () =>{

currentRoundNumber += 1;

}

updateScore(‘human’);

console.log(humanScore);