Challenge Project: Number Guesser

Why this code didn’t run?

let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;

// Write your code below:

//step.1
const generateTarget = () => {
  return Math.floor(Math.random() * 10);
};

//step.2
const compareGuesses = (human, computer, target) => {
  const humanDifference = Math.abs(target - human);
  const computerDifference = Math.abs(target - computer);
  return humanDifference <= computerDifference;

  /*if (humanDifference <= computerDifference) {
    return true;
  } else {
    return false;
  }
};*/

//step.3
const updateScore = winner => {
  if (winner === "human") {
    humanScore++;
  } else if (winner === "computer") {
    computerScore++;
  };

//step.4
const advanceRound = () => {
  currentRoundNumber++;
};

You seem to be missing a } at the end of the compareGuesses function (- it is commented out).
You seem to be missing a } at the end of the updateScore function.

Oops, thank you for finding the code where I was wrong :rofl: