搜索
您的当前位置:首页正文

js效率组装字符串StringBuffer_javascript技巧

2020-11-27 来源:易榕旅游

function StringBuffer() {
this.array = new Array();
}

StringBuffer.prototype.append = function(value) {
this.array[this.array.length] = value;
return this;
}

StringBuffer.prototype.toString = function() {
var _string = this.array.join("");
return _string;
}

Top