Maison >interface Web >js tutoriel >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;
return this;
}
}