my code link is: https://gist.github.com/485eeb02ece9687b647031ea8cd1dc6f and it is perfectly working. But I could not understand task no - 7 of this project. I am attaching the screenshot of

task no - 7.

Can anyone help me to incorporate task no-7 in my project?

the â€śproblemâ€ť is here:

```
const humanDifference = Math.abs(targetNumber - humanScore);
const computerDifference = Math.abs(targetNumber - computerScore);
```

you essentially do the same thing twice, so it would be cleaner (and easier to test) to move this functionality to its own function:

```
const humanDifference = getAbsoluteDistance(targetNumber, humanScore);
const computerDifference = getAbsoluteDistance(targetNumber, computerScore);
```

then do math within the getAbsoluteDistance function (which you will have to make). But you already have the logic, so shouldnâ€™t be to complicated.

this is called refactoring.

Thanks for Your help. But I still could not get it. Would You kindly refactor it in function getAbsoluteDistance( );

also please let me know how to use alert( );

well, pretty much the logic you have here:

```
Math.abs(targetNumber - humanScore);
```

but then with the parameters of of getAbsoluteDistance function.

the function call i demonstrated in my previous answer had two arguments, thus the function should have two parameters.

there isnâ€™t much to alert, have you checked the documentation?

https://developer.mozilla.org/en-US/docs/Web/API/Window/alert