I form DOM nodes as strings and append them to DOM tree like below using jQuery.
var dom = '<div><div style="display: inline-block">first name</div>'
'<div style="display: inline-block">last name</div></div>';
$("#contacts").append(dom);
The above code is a small sample. In most of my cases dom
will hold big strings.
When I recently read about JS performance tutorials, I saw this post. It mentioned that this way of string concatenation is not a good practice. It mentioned the use of .join()
instead of concatenation. That seems like an old post, so which one is efficient in these days?