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.

Description: Returns the absolute value of a number.

Example: absolute value of -42 => 42

Want to go further? Chain absolute with other functions in the visual Playground — pipe one output into the next and watch your data transform.

Related functions

© 2026 Heifara Buval