Hello everyone!
This is my first post on the community forum. If I missed anything from the guidelines about proper posting, please let me know and I will adjust to make it better.
I am currently working on the ‘Number Guesser’ project in JavaScript and I have my code done but not sure why its not working. Everything seems to be right? Here’s my code:
LINK TO PROJECT EXERCISE:
let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;
// Write your code below:
const generateTarget =() => { // Generate new secret number between 0 and 9
return Math.floor(Math.random() * 10);
}
const compareGuesses = (humanGuess, computerGuess, targetNum) => { //determine which guess is closest to the target number
let humanDiff = Math.abs((humanGuess - targetNum));
let computerDiff = Math.abs((computerGuess - targetNum));
if (humanDiff <= computerDiff) {
return true
}
else {
return false
}
const updateScore = (winner) => {
if (winner ===‘human’) {
humanScore =+ 1
}
if (winner ===‘computer’) {
computerScore =+ 1
}
const advancedRound = () => {
currentRoundNumber =+ 1
}
}