So I was looking to get an idea working but I can't seem to figure it out. I would like like to do something like the following.
// my old fasion code but not very flexibale
function runCode() {
var x = new myObject();
return x.run();
}
What I really like to be able to do.....
// pass in string paramater of object to create
// objName is the name of an object string to new like "myObject"
function runCode(objNameToUse) {
var x = new Object(objNameToUse);
return x.run();
}
runCode("myObject");
How could I do something like this using javascript?