Using Javascript i need to be able to:
1: Push a certain amount of the same function (with a different parameter in each) into an array.
2: Then run each functio
Is this what you needed?
1: Push a certain amount of the same function (with a different parameter in each) into an array.
function func(num){
alert(num);
}
var k = [];
k.push({f:func, params:[1]});
k.push({f:func, params:[2]});
k.push({f:func, params:[3]});
2: Then run each function one by one (for this example just an alert of the parameter/number)
3: After each function i need to be able to SPLICE that function out of the array
4: Check the Array Length after everytime - Once the array is empty again - alert the user it is complete
while (k.length > 0) {
k[0].f(k[0].params);
k.shift();
}
alert("done");