The code wouldn’t work. When calling the function, it would return undefined. Do I need to call other functions to make this work? Am I passing the wrong parameters?
The link to the practice: https://www.codecademy.com/paths/full-stack-engineer-career-path/tracks/fscp-javascript-syntax-part-i/modules/fecp-challenge-project-number-guesser/projects/number-guesser-independent-practice
let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;
// Write your code below:
const generateTarget = () => {
Math.floor(Math.random() * 10);
}
const compareGuesses = (humanGuess, computerGuess, targetGuess) => {
if (Math.abs((targetGuess - humanGuess)) >= (Math.abs(targetGuess - computerGuess))) {
return true;
}
else {
return false;
}
}
const updateScore = (winner) => {
if (winner === 'human') {
humanScore += 1;
}
else if (winner === 'computer') {
computerScore += 1;
}
}
const advanceRound = () => {
currentRoundNumber += 1;
}
compareGuesses(humanGuess, computerGuess, targetGuess);