js字符连接对象
来源:动视网
责编:小采
时间:2020-11-27 20:31:06
js字符连接对象
js字符连接对象:function StringBuffer(){ this.str = []; } StringBuffer.prototype = { append:function(str){ this.str.push(str); return this; }, toString:function(){ return this.str.join(''); }, clear:function(){ this.str.length = 0; retur
导读js字符连接对象:function StringBuffer(){ this.str = []; } StringBuffer.prototype = { append:function(str){ this.str.push(str); return this; }, toString:function(){ return this.str.join(''); }, clear:function(){ this.str.length = 0; retur

function StringBuffer(){
this.str = [];
}
StringBuffer.prototype = {
append:function(str){
this.str.push(str);
return this;
},
toString:function(){
return this.str.join('');
},
clear:function(){
this.str.length = 0;
return this;
}
}
js字符连接对象
js字符连接对象:function StringBuffer(){ this.str = []; } StringBuffer.prototype = { append:function(str){ this.str.push(str); return this; }, toString:function(){ return this.str.join(''); }, clear:function(){ this.str.length = 0; retur