如果我省去两句return this,会怎么样
function base(){
this.elements=[];
this.getid=function(id){
this.elements.push(document.getElementById(id));
return this;
};
this.gettag=function(tagname){
var tags=document.getElementsByTagName(tagname);
for(var i=0;i<tags.length;i++){
this.elements.push(tags[i]);
};
return this;
};
};
为什么需要return this呢
fishenal
朱奕嘉Yika