I am adding an anonymous function to an array and attempting to iterate over that array executing its contents. Even with a simple test case, I am getting a TypeError: is not a function.
Am I missing something simple?
//an array of functions
var signInFunctions = [];
//add a function to the array
signInFunctions.push(function() {
console.log("hello world");
});
function userSignedIn() {
//execute all functions in the signInFunctions array
for (var i = 0; i < signInFunctions.length; i++) {
signInFunctions(i);
}
}
userSignedIn();
Here's the error:
TypeError: 'function () {
console.log("hello world");
}' is not a function (evaluating 'signInFunctions(i)')