![]() |
VOOZH | about |
Javascript Math.abs() method is used to return the absolute value of a number. It takes a number as its parameter and returns its absolute value.
Math.abs(value)This method accepts a single parameter as mentioned above and described below:
The absolute value of the number passed as a parameter. The below examples illustrate the Math abs( ) method in JavaScript:
Example 1: This example shows the use of the Math.abs() method in javascript.
2 2.56
Example 2: This example shows the return value of Math.abs() method when the parameter is a string value.
NaN
Example 3: This example shows the return value of Math.abs() method when the parameter is an arithmetic expression.
16
We have a complete list of Javascript Math Objects methods, to check those please go through this article.