title: I don't understand my for loop?
body: <p>My question may silly, so apologize in advance. My instructions were to build a function that iterated over a queue of functions.  The answer is at the bottom....below the puzzlers array.</p>
  
  <p>Can someone explain why the command in the for-loop is <strong>input = queue.shift()(input);</strong>.  I understand that I had to use the shift method to empty the queue.  This exercise was confusing to me to begin with, but creating <strong>input = queue.shift()(input);</strong> is still strange to me.  any fundamental explanations would be greatly appreciated.  If you need more info, please let me know.....thank you in advance.</p>
  
  <pre><code>var puzzlers = [
      function ( a ) { return 8*a - 10; },
      function ( a ) { return (a-3) * (a-3) * (a-3); },
      function ( a ) { return a * a + 4; },
      function ( a ) { return a % 5; }
  ];
  
  var applyAndEmpty = function( input, queue ) {
      var length = queue.length;
      for(var i = 0; i&lt;length; i++){
          input = queue.shift()(input);
      }
      return input;
  };
  alert(applyAndEmpty(2, puzzlers));
  </code></pre>