Which one of the following is correct output for the following given JavaScript code:
<p id="demo"></p> <script> functionourFunction() { document.getElementById("demo").innerHTML=Math.abs(-7.25); } </script>
<p id="demo"></p>
<script>
functionourFunction()
{
document.getElementById("demo").innerHTML=Math.abs(-7.25);
}
</script>
a) 7
b) -7.25
c) 25
d) -7
Answer: C
Reason: In the following code, the method "abs ()" is used which returns absolute numbers as output hence the correct option is c. In JavaScript, the "abs ()" method is one of the methods stored in the library called Math's.