Javascript StringBuffer 类

function StringBuffer()
{
this.data = [];
}
StringBuffer.prototype.append = function()
{
this.data.push(arguments[0]);
return this;
}
StringBuffer.prototype.toString = function()
{
return this.data.join("");
}
// 应用
var a = new StringBuffer();
for (i=0; i<1000; i++)
{
a.append("<li>Item</li>");
}
document.write(a.toString())
