【发布时间】:2015-10-28 10:02:04
【问题描述】:
我在获取存储在变量中的方法名称时遇到了一些麻烦...这是我想要的一个示例:
Function MyObject(){
this.actualMethod = this.thatName;
}
MyObject.prototype.thatName = function(){}
MyObject.prototype.getActualMethodName = function(){
return this.actualMethod.name; /* This doesn't work since the function itself is anonymous, so this.actualMethod.name doesn't work... I want it to return "thatName" */
}
我试图用我的控制台浏览原型,但徒劳无功......有没有办法做到这一点?
【问题讨论】:
-
有什么问题?就
return this.actualMethod;
标签: javascript inheritance methods