I am dynamically loading functions as needed in my web app. When I request these functions as I need them, I'd like to check if they already exist. So I pass in an array of the function names such as ['Result','Question']. I then loop through that array and would like to see if it's typeof is a function, if so, then I know I don't need to load it.
Here is a simplified version:
function Result(){}
var functionName = 'Result';
if (typeof functionName == 'function'){
alert('function exists, don't load it');
else
alert('function does not exist, load it');
I know the above example doesn't work because I need the value of functionName, not functionName itself. Any ideas how to do this?