I ran across this problem when trying to populate a JS array for some animation I'm doing....the following Javascript function is invoked when I click a link within my web page for testing purposes:
function testing()
{
var funcArray = [];
var testFunc = function(){console.log("test function");}
funcArray.push(function(){console.log("hello there");});
funcArray.push(testFunc());
}
When this executes, I get "test function" to appear in the JS console, but not "hello there". Why does pushing the predefined testFunc cause output, but not the inline function in the first push?
funcArray.push(testFunc);