What will be the output of the following JavaScript code? [code] <head id="myHead"> <title>My title</title> </head> <p id="demo"></p> <script>

What will be the output of the following JavaScript code?
Code:
<head id="myHead">
  <title>My title</title>
</head>
<p id="demo"></p>
<script>
function myFunction() 
{
   var x = document.head.id;
   document.getElementById("demo").innerHTML = x;
}
</script>
A. demo
B. myHead
C. error
D. undefined
 

Tìm kiếm

Back
Top