Jsref Abs
# JavaScript abs() Method
[ JavaScript Math Object](#)
## Example
## Example
Returns the absolute value of a number:
Math.abs(-7.25);
Output:
7.25
[Try it Β»](#)
* * *
## Definition and Usage
The abs() method returns the absolute value of a number.
* * *
## Browser Support

The abs() method is supported in all major browsers.
* * *
## Syntax
Math.abs(_x_)
## Parameter Values
| Parameter | Description |
| :--- | :--- |
| _x_ | Required. Must be a number. |
## Return Value
| Type | Description |
| --- | --- |
| Number | The absolute value of x. Returns NaN if x is not a number, returns 0 if x is null. |
## Technical Details
| JavaScript Version: | 1.0 |
| --- |
* * *
## More Examples
## Example
In this example, I will get the absolute value of different types of arrays:
var a=Math.abs(7.25);
var b=Math.abs(-7.25);
var c=Math.abs(null);
var d=Math.abs("Hello");
var e=Math.abs(2+3);
Output:
7.25
7.25
0
NaN
5
[Try it Β»](#)
* * JavaScript Math Object](#)
YouTip