document write is an antipattern,
use:
function elemTest() {
var newDiv = document.createElement("div");
newDiv.innerHTML = "<h1>Hi there!</h1>";
document.body.appendChild(newDiv);
};
document write is an antipattern,
use:
function elemTest() {
var newDiv = document.createElement("div");
newDiv.innerHTML = "<h1>Hi there!</h1>";
document.body.appendChild(newDiv);
};