Pattern: DOM node insertion via appendChild
Issue: -
The append()
method is more versatile than appendChild()
as it can handle multiple nodes and both DOM nodes and strings in a single call.
Example of incorrect code:
foo.appendChild(bar);
Example of correct code:
foo.append(bar);
foo.append(textNode, elementNode, "text");