版权声明:转发博客 请注明出处 否则必究 https://blog.csdn.net/lucky541788/article/details/81948000
function hjQuery(){}
//下面一句 定义以后添加方法1、添加实例:hjQuery.extend({}); 2、添加原型:njQuery.prototype.extend({});
hjQuery.extend=hjQuery.prototype.extend=function(obj){
//此时此刻的this就是hjQuery的这个类
//console.log(this);
for(var key in obj){
//hjQuery["isTest"]=function(){console.log("test");}
this[key]=obj[key];
}
};
hjQuery.extend({
isTest:function(){
console.log('test');
}
});
hjQuery.isTest();