let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;
// Write your code below:
const generateTarget = () => {
return Math.floor(Math.random() * 10)
}
const compareGuesses = (humanGuess, computerGuess, targetGuess) => {
computerGuess = generateTarget();
humanPoint = Math.abs(targetGuess - humanGuess);
computerPoint = Math.abs(targetGuess - computerGuess);
console.log(humanPoint);
console.log(computerPoint);
if (computerPoint >= humanPoint) {
return true;
} else If (computerPoint < humanPoint)
return false;
}
const updateScore = (Winner) => {
if ("Winner" === 'human') {
humanScore = humanScore + 1;
} else if ("Winner" === 'computer') {
computerScore = computerScore + 1;
}
}
const advanceRound = () => {
currentRoundNumber++
}
// The Function Below This Is Call The Functions Above
updateScore('human');
console.log(humanScore); // To confirm that this value increased by 1
updateScore('computer');
console.log(computerScore); // To confirm that this value increased by 1