Callbacks for the same function
<p>I want to call a function a number of times providing it with different input on each occasion, however i am trying to ensure the next function call is triggered after the previous one has finished.</p>

<p>for example:</p>

<pre><code>func(1,2);
func(9,3);
func(6,4);
func(5,6);
</code></pre>

<p>I have seen callback be coded like;</p>

<pre><code>function1(someVariable, function() {
          function2(someOtherVariable);
        });
</code></pre>

<p>But this only works when calling a second function, i tried chaining the functions but this only allows me to run a set number of functions.</p>

<p>Is there a way i can apply some kind of call back to the same function?</p>

<p>note:: the function just adds a class.</p>

<pre><code>func(x, y){
   $("#block").addClass("class");
    setTimeout(function(){ 
         $("#block").removeClass("class");
     },1000);
};
</code></pre>
