VBScript Abs Function

Definition and Usage

The Abs function can return the absolute value of a specified number.

Note:If the number parameter contains Null, it returns Null.

Note:If the number parameter is an uninitialized variable, it returns 0.

Syntax

Abs(number)
Parameter Description
number Required. A numeric expression.

Example

Example 1

document.write(Abs(1))
document.write(Abs(-1))

Output:

1
1

Example 2

document.write(Abs(48.4))
document.write(Abs(-48.4))

Output:

48.4
48.4