The fun part of Javascript is that functions are variables and at a first glance it might look a weird thing but when you get used to this concept you realize it's a great thing.
Let's see with the following example how to create an array of functions and then fire them sequentially when needed.
var arrayF = [
[console.log, ['test1']],
[console.log, ['test2', 'test3']],
[console.error,['test4']]
];
arrayF.push([alert, ['test5']]);
for(i in arrayF)
arrayF[i][0].apply(window, arrayF[i][1]);Handy, isn't it? This thing can be very useful when you need to execute a procedure which include several existing functions.
Also, you could create an array of functions and a caller, which could look like:
function caller(start, end){
for(i=start;i<end;i++)
arrayF[i][0].apply(window, arrayF[i][1]);and then invoke a subset of functions only.


