Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
abs Method
-
2012年10月04日
Returns the absolute value of a number.
function abs( number : Number ) : Number
Arguments
- number
Required. A numeric expression.
Remarks
The return value is the absolute value of the number argument.
Example
The following example illustrates the use of the abs method.
function ComparePosNegVal(n) {
var s = "";
var v1 = Math.abs(n);
var v2 = Math.abs(-n);
if (v1 == v2) {
s = "The absolute values of " + n + " and "
s += -n + " are identical.";
}
return(s);
}