Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
411 views
in Technique[技术] by (71.8m points)

为什么没有实现继承?

var CheckObject = function(){};
CheckObject.checkName = function(){
    
}
CheckObject.checkEmail = function(){

}
CheckObject.checkPassword = function(){

}
var a = CheckObject();
console.log(window);
//控制台中结果
//checkObject:function(){}包含checkName,checkEmail和checkPassword方法。
//a:undefined

求问大神为什么没有实现继承?

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

a是checkObject这个函数返回的值,既然没有显式返回的话就是undefined的啦。此外你应该区分构造函数和调用普通函数的区别……


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...