我有一些看起来像这样的代码
var viewService = function () {
...
return {
...
,isAbsolute: function (view) { ... }
...
,removeAbsoluteViews: function () { ... }
}
};
};
我想做的是从isAbsolute
致电removeAbsoluteViews
。当我尝试这样做时
if (isAbsolute(v) === false) { ... }
我收到错误消息,指出isAbsolute
未定义。我怎么能这样做?
答案 0 :(得分:3)
答案 1 :(得分:3)
this
关键字:if (this.isAbsolute(v) === false) { ... }
this
关键字):var viewService = function () {
function isAbsolute (view) { ... }
function removeAbsoluteViews () {
if (isAbsolute(v) === false) { ... }
}
...
return {
isAbsolute: isAbsolute,
removeAbsoluteViews: removeAbsoluteViews
};
};