M Math.abs() (Function) Math.abs() (Function) The absolute (Business web hosting)
M Math.abs() (Function) Math.abs() (Function) The absolute value of a positive or negative number. Some meaningful numeric value This function returns the absolute value of the argument. The absolute value of a number is its distance from zero. In general, the result has the same magnitude as the argument but always has a positive sign. Special boundary conditions that affect the results are: Availability: ECMAScript edition 2 JavaScript 1.0 JScript 1.0 Internet Explorer 3.02 Netscape 2.0 Netscape Enterprise Server 2.0 Opera 3.0 Property/method value type: Number primitive JavaScript syntax: -Math.abs(aValue) Argument list: aValue Argument Result 0 0 NaN NaN negative infinity positive infinity On some implementations, the absolute value of the most negative integer number may not be representable in the positive range. This is not the same as Number.MIN_VALUE and Number.MAX_VALUE. They describe the largest and smallest possible positive floating point values. Warnings: . It is possible that due to the underlying implementation of the math library, the absolute value of the most negative number may not be representable and it may yield NaN instead. Example code: