📜  .append 和 .appendChild 之间的区别 - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:22.527000             🧑  作者: Mango

代码示例1
.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