Math.abs()
syntax: |
Math.abs(x) |
where: |
x - a number.
|
return: |
number - the absolute value of x. Returns NaN if x cannot be converted to a number.
|
description: |
Computes the absolute value of a number.
|
example: |
//The function returns the absolute value // of the number -2 (i.e. //the return value is 2): var n = Math.abs(-2); |