Shorthand Javascript & jQuery

I always like use short, swift script lines especially when working with the jQuery object.

$(‘#id’)[doShow ? ‘show’ : ‘hide’]();

Is the same and still just as readable as:

var e = $(‘#id’);
if(doShow)
e.show();
else
e.hide();

You could of course use a toggle() concept in this case but you get the idea.

Following

  • funniest10k
  • the-absolute-funniest-posts
  • mikelernerphotography
  • attentionindustry
  • tastefullyoffensive
  • evangotlib
  • infoneer-pulse
  • merlin
  • poplipps
  • cavalier
  • redshooter
  • frezned
  • amyvernon
  • minimalistco
  • theclearlydope
  • deviantart
  • yagottabelieve
  • mashable
  • poptech
  • gregbabula
  • john
  • teaim
  • despicablealexis
  • purple-lightsaber
  • toptumbles
  • hellonewyork
  • nonprofit-design
  • plus5mace
  • wantful
  • pixel2html
  • adobegripes
  • kimjongillookingatthings
  • tuneage
  • mikehudack
  • sirmitchell
  • officialbeastieboys
  • wondertonic
  • jordanwaller
  • badassjs
  • iiiil0liiii
  • fuzzythinking
  • manxmidge
  • rosskempfolds
  • londonelek
  • bigpinots
  • hoveringartdirectors