Number Guesser JS challenge - Why does targetGuess work?

Hello! I have a slight problem understanding in the following challenge

With this part of the code:

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

const humanDifference = Math.abs(targetGuess - humanGuess)

const computerDifference = Math.abs(targetGuess - computerGuess)

return humanDifference <= computerDifference

why does the targetGuess work? Where does it get its value? Because in the script.js file there is generateTarget, which as understand defines the number of the target. But I couldn’t find any part that of the code in script.js and game.js that would tie generateTarget directly to targetGuess. What am I missing?

Do you understand function parameter and arguments? Parameter act as placeholders until they get a value which you provide at function call. In this case, that could be the result of calling generateTarget.

1 Like

When I did this, it has been a bit since I last coded. Took a step back to review parameters lesson again properly! Thank you now I understand!