We've all been there before - concatenating strings of html, but which way is quicker?
1) Recursive concatenation.
var html = "<html>" + "<head>" + "<title>";
2) Append to the variable.
var html = "<html>";
html += "<head>";
html += "<title>";
3) Join the array
var html = ["<html>", "<head>", "<title>"].join("");
The fastest string concatenation is using option 3 - this is down to the array's internal string builder facility which allows for much faster string manipulation. Of course it's only going to make a big difference when contactenating strings over many iterations - such as creating a large html table. Over a very small number of iterations the difference is so negligable as to be inconsequential.