function stringbuilder()
{
this.arr = new Array();
this.append=function(str)
{
this.arr.push(str);
}
this.tostring = function()
{
return this.arr.join('');
}
}
var sb = new stringbuilder();
sb.append("hello");
sb.append("doudou");
$("#div1").html(sb.tostring());