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.
for example:
func(1,2);
func(9,3);
func(6,4);
func(5,6);
I have seen callback be coded like;
function1(someVariable, function() {
function2(someOtherVariable);
});
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.
Is there a way i can apply some kind of call back to the same function?
note:: the function just adds a class.
func(x, y){
$("#block").addClass("class");
setTimeout(function(){
$("#block").removeClass("class");
},1000);
};