|
|
|
|
|
by adatta02
6070 days ago
|
|
I'd be more interested in seeing these techniques applied to Javascript that is coded up with a framework (say jQuery for arguments sake). For example, what is the performance penalty of: var arr = [1, 2, 3];
for(var i=0; i < arr.length; i++){ //stuff }
// versus
$.each( arr, function(i, val){ // stuff } );
Or @ caching: $("a").each( function(){
$(this).click(
$(this).find("img").hide();
);
});
// versus
$("a").each( function(){
var targetImage = $(this).find("img");
$(this).click(
$(targetImage).hide();
);
});
|
|