为数据添加append,remove功能
摘要:Array.prototype.append=function(str){varnewArr=newArray(str);returnthi...
Array.prototype.append=function(str){
varnewArr=newArray(str);
returnthis.concat(newArr);
}
Array.prototype.remove=function(str){
varretArr=newArray();
for(i=0;i<this.length;i++){
if(this[i]!=str)retArr=retArr.append(this[i]);
}
returnretArr;
}
Array.prototype.hasItem=function(str){
for(vari=0;i<this.length;i++){
if(this[i]==str){
returntrue;
}
}
returnfalse;
}
提示:javascript没有add,但是有push和unshift方法,没有remove,但有pop和shift方法,如果不行,还有splice方法
【为数据添加append,remove功能】相关文章:
★ popdiv
★ 网页与键盘
上一篇:
Array对象方法参考
下一篇:
让您的菜单不离网站