function stringbuffer(){
this.array = new Array();
}
stringbuffer.prototype.append = function(s){
this.array.push(s);
}
stringbuffer.prototype.tostring = function(){
return this.array.join('-');
}
var sb = new stringbuffer();
sb.append('tom');
sb.append('lily');
alert( sb.tostring());