匿名関数を配列に追加し、その内容を実行する配列を反復処理しようとしています。単純なテスト ケースでも、TypeError: is not a function が発生します。
簡単なものがありませんか?
//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();
エラーは次のとおりです。
TypeError: 'function () {
console.log("hello world");
}' is not a function (evaluating 'signInFunctions(i)')