Hello, I’m currently doing the random numbers game:

https://www.codecademy.com/practice/projects/number-guesser-independent-practice

This is my code below

let humanScore = 0;

let computerScore = 0;

let currentRoundNumber = 1;

//write your code here

const generateTarget = () =>

Math.floor(Math.random() *10);

const getAbsoluteDistance = (a, b) => {

return Math.abs(a - b);

}

const compareGuesses = (humanGuess, compGuess, targetGuess) => {

const humanDiff = getAbsoluteDistance(huamnGuess, targetGuess);

const compDiff = getAbsoluteDistance(compGuess, targetGuess);

return humanDiff <= compDiff ? true : false;

};

const updateScore = winner => {

if (winner === ‘human’) {

humanScore++;

} else if (winner === ‘computer’) {

computerScore++;

}

};

const advanceRound = () => {

currentRoundNumber++;

};

I originally had it working but I’m trying to do the extra step:

- You probably calculated the distance from the computer guess to the target and from the human guess to the target. Move this into a separate
`getAbsoluteDistance()`

function that takes two numbers and returns the distance, and then use that inside your`compareGuesses()`

function.

I am completely stuck as to why any code is not working, any help?