The below code works properly if is use function name directly and not as a variable with the function name.
I would make work this loop with the variable having the function name.
Please help !
function func_1() {
alert("FUNCTION EXISTS");
}
function func_2() {
alert("FUNCTION EXISTS");
}
var functions = ["func_1", "func_2", "func_3", "func_4"];
for (var i = 0; i < functions.length; i++) {
var func_name = functions[i]; // THIS DOESNT WORK < THIS IS THE ONE I WOULD WANT TO WORK
var func_name = func_3; // THIS WORKS
if (typeof func_name === 'function') {
alert("HELLO WORLD");
}
alert("ITERATING WELL");
}