Hello everyone, a newbie in Javascript here having an issue.

Well, the step #8 in this project advises to create a separate function to calculate the distance between the computer guess to the target and the human guess to target.

I’ve seen that most fellow learners create a separate function just to use again the Math.abs(), which I honestly think, don’t make a difference.

I wanted to practice even further and see if we can actually re-create Math.abs() with the function I called getAbsoluteDistance(), however, the new code I made seems to partially work, as the computer always win.

I appreciate any feedback.

```
let humanScore = 0;
let computerScore = 0;
let currentRoundNumber = 1;
// Write your code below:
const generateTarget = () => Math.floor(Math.random()*10);
//This is a new function created to replace Math.abs()
const getAbsoluteDistance = (numberA, numberB) => {
let numberC = numberA - numberB;
if (numberC < 0) {
return numberC *= -1;
} else {
return numberC;
}
}
const compareGuesses = (userGuess, computerGuess, secretTargetGuess) => {
getAbsoluteDistance(userGuess,secretTargetGuess) <= getAbsoluteDistance(computerGuess,secretTargetGuess) ? true : false
/*Below piece of code is the original step #4, it's commented out to create and absolute distance function getAbsoluteDistance() instead of Math.abs():
Math.abs(userGuess - secretTargetGuess) <= Math.abs(computerGuess - secretTargetGuess) ? true : false;*/
}
let updateScore = winner => winner === 'human' ? humanScore += 1 : computerScore += 1;
const advanceRound = () => currentRoundNumber += 1;
```