Math.abs(number)
Top
Previous
Next
Syntax
Math.abs(x)
Arguments
x: A number or expression.
Returns
A number, the absolute value of x.
Description
Method: Returns the absolute value of x.
Sample
Math.abs(
3
.
4
);
// returns 3.4
Math.abs(-
3
.
4
);
// returns 3.4