I was wondering if it's possible to call a function by passing a string name. Following is the basic architecture:
Javascript:
"use strict";
function foo(){
var f = this;
f.fn = function(o){return fn(o)}
function fn(o){
o.name();
}
function a(){
alert('a');
}
function b(){
alert('bb');
}
}
var f = new foo();
f.fn({name:'a'});
f.fn({name:'b'});
The code is setup at http://jsfiddle.net/rexonms/9c7bnkc9/.