Skip to content

Instantly share code, notes, and snippets.

Created January 27, 2013 03:45
Show Gist options
  • Save anonymous/4646158 to your computer and use it in GitHub Desktop.
Save anonymous/4646158 to your computer and use it in GitHub Desktop.
Yo dawg, I herd you like loops, so jQuery put a loop in your code
// Indications of Confusion
$( ".bla" ).each( function() {
$( this ).css( "color", "green" );
});
// Explicit Loops
$( ".bla" ).each( function( index, element ) {
$( element ).append( index );
});
// Implicit Loops
$( ".bla" ).addClass( "highlight" );
// Performance Implications
$( ".bla" ).css( "x", "y" ).css( "a", "b" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment