我需要知道原型类是否理解方法。例如:
MyClass.prototype.myMethod1 = function() {
...
return "Hello World!";
};
MyClass.prototype.myMethod2 = function() {
...
return "Bye World!";
};
MyClass.prototype.caller = function(functionName){ //This is the method that I need to know
if (functionName == "myMethod1") return "Exist!, is myMethod1.";
if (functionName == "myMethod2") return "Exist!, is myMethod2.";
return "Sorry, it doesn't exists here.";
}
这只是一个糟糕的例子。我需要确定MyClass是否不理解该方法,并在这种情况下委托它。
谢谢!