JavaScript absolute
Math.abs() returns the absolute value of a number — its distance from zero, always non-negative.
Syntax
Math.abs(num) Examples
| Input | Arguments | Output |
|---|---|---|
| -5 | — | 5 |
Try it live
Type your input and see absolute transform it instantly.
Want to go further? Chain absolute with other functions in the visual Playground — pipe one output into the next and watch your data transform.