Pham Quỳnh Anh
New member
What will be the output of the following JavaScript code?
A. demo
B. myHead
C. error
D. undefined
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>
B. myHead
C. error
D. undefined