var OrderDetails = function () {
var orderdetails = {};
orderdetails.doSomething = function(){
alert('do something');
};
return orderdetails;
}
elsewhere in the code...
processMethod('doSomething')
function processMethod(strMethod)
{
// strMethod = 'doSomething';
var orderdet = OrderDetails(); //not the exact instantiation, just illustrating it is instantiated
orderdet.strMethod(); //this is the line I'm stuck with.
}
I'm currently trying to call a method via it's String name in Javascript. I've looked at apply, call, and eval() as potential solutions to this problem, but can't seem to get any of them to work. Anyone any guidance on syntax, for my particular object scenario?