VBScript AbsFunction
Complete VBScript Reference
The Abs function returns 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. |
Examples
Example 1
<script type="text/vbscript">
document.write(Abs(1) & "<br />")
document.write(Abs(-1))
</script>
document.write(Abs(1) & "<br />")
document.write(Abs(-1))
</script>
The above example outputs:
1
1
1
Try it Yourself »
Example 2
<script type="text/vbscript">
document.write(Abs(48.4) & "<br />")
document.write(Abs(-48.4))
</script>
document.write(Abs(48.4) & "<br />")
document.write(Abs(-48.4))
</script>
The above example outputs:
48.4
48.4
48.4
Try it Yourself »
Complete VBScript Reference Other Extensions