将Person功能定义如下,
function Person() {
this.GetContactDetail = function() {
// Can I make a call to GetFullDetail function over here is it possible ,
// I tried but it doesnt calls the GetFullDetail function
this.GetFullDetail;
};
this.GetFullDetail = function() {
};
};
var objPer = new Person();
objPer.GetContactDetail();
以上代码只是参考的片段。
答案 0 :(得分:1)
为了在javascript中调用函数,您应该在其名称后面使用()。只是引用它,就不会调用它。
所以你应该这样做:
this.GetFullDetail();
答案 1 :(得分:0)
调用函数
this.GetFullDetail();
此this.GetFullDetail;
显示Person variable
。
答案 2 :(得分:-1)
this
不是指Person
,而是指GetContactDetails
上下文。您应该在{。}}之外保存对{。}}的引用。
this