JavaScript abs() Method: Math Object
Description
The abs() method of math object is used to get the absolute value of a number.
Version
Implemented in JavaScript 1.0
Syntax
abs(x)
Parameter
x : A number

Example:
In the following web document, abs() method returns the absolute value of various numbers.
View the example in the browser
Supported Browser
Internet Explorer 7 | Firefox 3.6 | Google Chrome 7 | Safari 5.0.1 | Opera 10 |
Yes | Yes | Yes | Yes | Yes |
See also:
JavaScript Core objects, methods, properties
Previous: JavaScript SQRT2 Property: Math Object
Next:
JavaScript acos() Method: Math Object
Test your Programming skills with w3resource's quiz.