Im bit stuck at Number guesser project on Full-stack dev course.
I should compare guesses between target number, but im bit off how to express it in If statement.
Create a compareGuesses()
function. This function will be called each round to determine which guess is closest to the target number.
This function:
- Has three parameters representing the user (human) guess, a computer guess, and the secret target number to be guessed.
- Determines which player (human or computer) wins based on which guess is closest to the target. If both players are tied, the human user should win.
- Return
true
if the human player wins, andfalse
if the computer player wins.