This question is already existing in a different way, but my code is mostly different so I dont get the solution out of the other answers. That's a example Code:
http://jsfiddle.net/e52n28xs/
I want start the function like this:
var test1 = {
start: function() { }
};
var fn = 'test1';
fn.start();
I know the following works, but I need the string option.
test1.start();
Maybe that's impossible?
test1is in the global scope, you could dowindow[fn]().test1..n, use an array instead.(new Function(fn+'.start'))();test1in a context, e.g.var ctx = { test1: { start: function() {} }? Then it would bectx['test1'].start();.