Possible Duplicate:
JavaScript string concatenation
does javascript have a built in stringbuilder class?
As it’s known when we do str = str + "123" a new string is created. If we have a large number of concatenations it can be rather expensive. Is there a simple way to implement a StringBuilder in JavaScript?
You can push the parts into an array, and then join it:
This SO question explains it in detail, see also this class