摘要: 和Java一样,JS中直接用"+"号拼凑字符串是很耗费资源的,所以在大量拼凑字符串的情景中,我们也需要一个类似于StringBuffer的工具,下面利用Array.join()方法实现StringBufferfunction StringBuffer() { this._strs = new Array; } StringBuffer.prototype.append = function (str) { this._strs.push(str); }; StringBuffer.prototype.toString = function() { return this.. 阅读全文
posted @ 2013-11-20 11:22 _流年 阅读(897) 评论(0) 推荐(0) 编辑