JavaScript StringBuffer
function StringBuffer() { this.buffer = []; }To use it:StringBuffer.prototype.append = function(string)
{
this.buffer.push(string);
return this;
}StringBuffer.prototype.toString = function()
{
return this.buffer.join("");
}
var s = new StringBuffer();link:
s.append("Hello, ").append(" World!");
alert(s.toString());