for(var i=0; i<count; ++i)
$get('divContent').appendChild(elements[i]);
As you can figure out the code is going to be something like:
var divContent = $get('divContent');
for(var i=0; i<count; ++i)
divContent.appendChild(elements[i]);
That is fine, but you can also cache browser function like
appendChild
. So, the ultimate optimization will be like the following:var divContentAppendChild = $get('divContent').appendChild;
for(var i=0; i<count; ++i)
divContentAppendChild(elements[i]);
No comments:
Post a Comment