Code // Initializes a new instance of the StringBuilder class
// and appends the given value if supplied function StringBuilder(value)
{ this.strings =new Array(""); this.append(value);
}
// Appends the given value to the end of this instance. StringBuilder.prototype.append =function (value)
{ if (value)
{ this.strings.push(value);
}
}
// Converts this instance to a String. StringBuilder.prototype.toString =function ()
{ returnthis.strings.join("");
}
Code // create a StringBuilder var sb =new StringBuilder();
// append some text sb.append("Lorem ipsum dolor sit amet, consectetuer adipiscing elit, ");
sb.append("sed diem nonummy nibh euismod tincidunt ut lacreet dolore ");
sb.append("magna aliguam erat volutpat.");
// get the full string value var s = sb.toString();