Number Guesser - Step 4

Hi team,

I’m stuck in step 4, I am creating the function with the name “compareGuess()” and three parameters, now I got stock in how to use Math.abs(), please help :frowning:

Hello @pablo.lopez10, welcome to the forums! Math.abs() returns the absolute value of a number. That is, whatever value you give it, it will return the positive version of it:

Math.abs(-3)//returns 3
Math.abs(3)//returns 3
Math.abs(0)//returns 0

I hope this helps!

1 Like

Thank you very much! You gave me a better idea and how to code

1 Like