Hey, guys. I started this project and so far I have been having a lot of issues unlike with the previous JavaScript projects. I started building it out but I can’t seem to find the reason why it doesn’t work. See the code below:
let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;
// Write your code below:
const generateTarget = () => {
return Math.floor(Math.random() * 10)
}
const compareGuesses = function(humanGuess, computerGuess, targetGuess) {
if (humanGuess == computerGuess) {
return true;
} else if (Math.abs(humanGuess - targetGuess) > Math.abs(computerGuess - targetGuess)) {
return false;
} else if (Math.abs(humanGuess - targetGuess) < Math.abs(computerGuess - targetGuess)) {
return true;
}
}
const updateScore = (winner) => {
if (compareGuesses = true) {
humanScore += 1;
} else if (compareGueses = false) {
computerScore +=1;
}
}
As you can see I haven’t finished it yet, but this is because the score is not getting updated with the code I wrote.
Thanks in advance for anyone who has time to look into this!