Difference between innerHTML and append()

InnerHTML is not standard, and its a String. The DOM is not, and although innerHTML is faster and less verbose, its better to use the DOM methods like appendChild(), firstChild.nodeValue, etc to alter innerHTML content.

Advertisements

JavaScript’s with statement

JavaScript’s with statement was intended to provide a shorthand for writing recurring accesses to objects. So instead of writing

uuu.eee.oo.ah_ah.ting.tang.rehrr.tett.bing = true;
uuu.eee.oo.ah_ah.ting.tang.rehrr.tett.bang = true;

You can write

with (ooo.eee.oo.ah_ah.ting.tang.walla.walla) {
bing = true;
bang = true;
}