Math.abs

Returns the absolute value of a number.

Method of Math
Static

Syntax

abs( x )

Parameters

Parameter Description
x A number

Examples

The following function returns the absolute value of the variable x:

Description

Because abs is a static method of Math, you always use it as Math.abs(), rather than as a method of a Math object you created.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.