Home | Javascript validator | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.
Microsoft® JScript®
abs Method
 Language Reference 
Version 1 

See Also                  Applies To


Description
Returns the absolute value of a number.
Syntax
Math.abs(number)

The number argument is a numeric expression for which the absolute value is sought.

Remarks
The return value is the absolute value of the number argument.

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);
}

Home | Javascript validator | JavaScript Editor JavaScript EditorGet Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.