This work:
var stepFunc =
[
//Step 0 (it doe not exist)
function(){console.log("Step 0");},
//Step 1
(function(){
var fFirstTime = true;
return function(){
console.log("Step 1");
if (fFirstTime){
//Do Something
}
}
})(),
// ... Other steps
];
This does NOT work :
var stepFunc =
[ // Step 0
[
function(){console.log("Step 0");},
function(){console.log("Check Step 0");}
], //Step 1
(function(){
var fFirstTime = true;
return
[
function() { //Initialization function
console.log("Step 1");
if (fFirstTime){
//Do somrthing
}
}, function() {
return true;
}
];
})(),
// ...
];
I would like that stepFunc would be an array of arrays of functions. On the first level I want to create a closure that has its own data. Why is stepFunc[1] "undefined" ?