Possible Duplicate:
Why is string concatenation faster than array join?
Usually we need to generate html contents dynamically in Javascript. Two ways like below:
var s = "", a = [];
for (var i = 0, l = data.length; i < l; i++) {
s += "<a href='#'>" + data[i].name + "</a>";
a[i] = "<a href='#'>" + data[i].name + "</a>";
}
container.innerHTML = s; // or
container.innerHTML = a.join("");
Which way is better? Mainly foucus on performance, or the differences can be ignored.