difference beween append and append child code example

Example: difference between .append and .appendChild

.append()
This method is used to add an element in form of a Node object or a DOMString (basically means text).

.appendChild()
Similar to the .append method, this method is used to elements in the DOM, but in this case, only accepts a Node object.

--Differences--
1).append accepts Node objects and DOMStrings while .appendChild accepts only Node objects
2).append does not have a return value while .appendChild returns the appended Node object
3).append allows you to add multiple items while appendChild allows only a single item

Tags:

Misc Example