From http://www.w3schools.com (Copyright Refsnes Data)
JavaScript Math Object
The abs() method returns the absolute value of a number.
| Math.abs(x) |
| Parameter | Description |
|---|---|
| x | Required. Must be a numeric value |
ExampleGet the absolute values of positive and negative numbers:
The output of the code above will be:
Try it yourself » |
JavaScript Math Object
From http://www.w3schools.com (Copyright Refsnes Data)