This function calculates and returns the absolute value. Suppose the value of any variable is –345 the absolute value of –345 will be 345. if the value of a variable is 345 then the absolute value of variable will be 345.
<html>
<head>
</head>
<body>
<script>
var a=-45
document.write("<br> Value of a :"+a)
document.write("<br> Absolute Value of a :"+Math.abs(a))
</script>
</body>
</html>