Edit in JSFiddle

var divs=document.getElementsByTagName("div");

log("divs.length="+divs.length);

document.body.appendChild(document.createElement("div"));
document.body.appendChild(document.createElement("div"));
document.body.appendChild(document.createElement("div"));

log("divs.length="+divs.length);

document.body.removeChild(divs[0]);

log("divs.length="+divs.length);

function log(s) {
    $("log").grab(document.newTextNode(s+"\n"));
}
<div></div>
<div></div>
<div></div>
<div></div>


<pre id="log"></pre>