foo 3秒後にh2だけになります。

<h1>foo 3秒後にh2だけになります。</h1>
<script>
setTimeout(function() {
  document.write('<h2>bar</h2>');
}, 3000);
</script>