<html>
<body id="parent">
<script>
var body = document.getElementById("parent");
var heading = document.createElement("h2");
heading.innerHTML = "Scoop!";
var heading2 = document.createElement("h2");
heading2.innerHTML = "Breaking News!";
body.appendChild(heading2);
</script>
</body>
</html>]]>- A heading displaying
Breaking News!
gets nested inside the body
- The text
heading
displays inside the body
- A paragraph displaying
Breaking News!
gets nested inside the body
A heading displaying Breaking News!
gets nested inside the body
.