**Please I am stuck with the Math.abs() function. How do I use it properly?
Math.abs() function returns the absolute value of a number-that is, it returns the positive reciprocal of that number:
Math.abs(5) >>returns 5 Math.abs(-2) >>returns 2 Math.abs(-98.7) >>returns 98.7
I hope this helps!
Thank you for your response. This helped.
Maths.abs(x) gives absolute number
var x = Math.abs(98.3); //gives 98.3
var x = Math.abs(-98.3); //gives 98.3
var x = Math.abs(null); //gives 0
var x = Math.abs(“Hello”); //gives NaN Not A Number
var x = Math.abs(2+3); //gives 5
also depends what you are trying to achieve. You could share your thought with us for assist. Cheers
Thanks a lot. It is clear now!