英 [æbz]

abbr.acrylonitrile-butadiene-styrene acrylonitrile-butadiene-styrene;absence absence;absorption absorption;absorb (ent) absorption

javascript abs() method syntax

Function: Return the absolute value of the number.

Syntax: Math.abs(x)
Parameters: x Required. Must be a numeric value.​

Return: the absolute value of x.

javascript abs() method example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script type="text/javascript">
//取得正数和负数的绝对值
    document.write(Math.abs(7.25) + "<br />")
    document.write(Math.abs(-7.25) + "<br />")
    document.write(Math.abs(7.25-10))

</script>

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance