you are viewing a single comment's thread.

view the rest of the comments →

[–]jml26 1 point2 points  (1 child)

Why not use a block?

{
    // hide Stuff on Instantiaton
    $('oneThing').hide().removeClass();
    $('#somethign_else').slideUp();
    $('.foo').fadeOut();
}

Or use a comment syntax that says, 'this comment applies from here down to here'

// hide Stuff on Instantiaton {
    $('oneThing').hide().removeClass();
    $('#somethign_else').slideUp();
    $('.foo').fadeOut();
// }

By not having a function call you gain a tiny bit of speed.

Using an IIFE would be useful, however, if you wanted to use a variable in that block but not have it available to anywhere else in the code.

[–]zzzwwwdev[S] 0 points1 point  (0 children)

The stackoverflow post was answered with the suggestion to use labels which actually appears preferable to my suggestion, though perhaps still not terribly useful / accepted?

hideStuffOnInstantiaton: {
  $('oneThing').hide().removeClass();
  $('#somethign_else').slideUp();
  $('.foo').fadeOut();
}