var aQuery = function(selector, context) {
return aQuery.prototype.init();
}
aQuery.prototype = {
init:function(){
return this;
},
name:function(){console.log('name')},
age:function(){console.log('age')}
}
var it = aQuery()
console.log(it == aQuery.prototype)
it.name();
var aQuery2 = function(selector, context) {
return aQuery2.prototype.init();
}
aQuery2.prototype = {
init: function() {
this.age = 18
return this;
},
name: function() {},
age: 20
}
console.log(aQuery2().age)
var aQuery3 = function(selector, context) {
return new aQuery3.prototype.init();
}
aQuery3.prototype = {
init: function() {
this.age = 18
return this;
},
name: function() {},
age: 20
}
var aQuery4 = function(selector, context) {
return new aQuery4.prototype.init();
}
aQuery4.prototype = {
init: function() {
return this;
},
name: function() {
return this.age
},
age: 20
}
aQuery4.prototype.init.prototype = aQuery4.prototype;
console.log(aQuery4().name())
console.log(aQuery4.prototype.name());
console