The Math.abs(x) method returns the absolute (positive) value of x:

Example

Math.abs(-4.7);



Practice Excercise Practice now