Why is doing
var consoleElem = document.getElementById("debug");
consoleElem.appendChild(msgElement)
the same thing as
document.getElementById('debug').appendChild(msgElement);
It seems to me that the DOM element (debug) is its own variable, and then to copy it to another variable means I have two copies of the debug element... why should any changes I make to the new copy (var consoleElem) make changes to the original DOM element?