I have a constructor function, for example webapp.core.cf1 or Backbone.Router. But I get this constructor function not as a reference, but as a string! I cannot change this requirement, the constr. must be in a string. How can I make a new object from this, for instance classfun("Backbone.Router")?
function classfun (cfstr)
{
...
cf = new window[cfstr]();
If I try it this way, I get the error: ... is not a constructor.
Why this does not work? Is there an alternative way without using eval()?
Thanks a lot in advance
EDIT
Thank you all for your answers!
Thank you, Tronix117, this was the problem!!
Thank you, Benjamin Schulte, for the function!
classfun? What type of variable are you passing into it?