笔记:JS高性能字符串连接StringBuffer类
function StringBuffer(){ this.__strings__ = new Array(); } StringBuffer.prototype.append = function(str){ this.__strings__.push(str); }; StringBuffer.prototype.toString = function(){ this.__strings__.join(" "); };
使用StringBuffer类比使用加号节省50%左右的时间...