Returns the absolute value of a number.
Applies to
Math
Syntax
abs(x)
Parameters
x
A number.
Example
The following function returns the absolute value of the variable x:
Description
abs is a static method of Math. As a result, you always use it as Math.abs(), rather than as a method of a Math object you create.