var aQuery = function(selector, context) { return new aQuery.prototype.init();
}
aQuery.prototype = {
init: function() { return this;
},
name: function() {
};上面这个代码,根据测试,aQuery.prototype.init()最后返回的应该是aQuery.prototype本身,那么aQuery()最后返回的可以说是new的init的一个实例,也可以当成是aQuery.prototype的一个实例?
var aQuery = function(selector, context) {
}
aQuery.prototype = { init: function() { return this;
}, name: function() {
alert("hi")},
};console.log(new aQuery.prototype)这个却显示aQuery.prototype不是一个constructor,反而aQuery.prototype.init()倒是可以new,两者不是一样的吗
牛魔王的故事
相关分类