Normally we can do this:
var somefunc = function(){
this.func1 = function(){ .... }
this.func2 = function(){ .... }
};
myvar = new somefunc();
Then we can call myvar.func1() to run the function.
But, just my thinking. Is it possible to store functions into array and then we can just run all the functions in the array by loop through the array? If possible, then how can I push a function into array?
Thank you.
Array.prototype.push, just like you would with any other item you can push into an array, since functions are first-class citizens in JavaScript.