title: Looping within functions
body: <p>I'd like to repeat a certain piece of code with a two second interval inbetween, how would I do so?</p>
  
  <pre><code>$(document).keydown(function(e) {
        kkeys.push( e.keyCode );
        if ( kkeys.toString().indexOf( konami ) &gt;= 0 ) {
          $(document).unbind('keydown',arguments.callee);
              $('.preview').attr('style', 'background: #'+Math.floor(Math.random()*16777215).toString(16) + ';');
        }
      });
  </code></pre>
  
  <p>with this being repeated:</p>
  
  <pre><code>$('.preview').attr('style', 'background: #'+Math.floor(Math.random()*16777215).toString(16) + ';');
  </code></pre>