JavaScript DOM Scripting By Example Adding and Removing Names RSVP Checkbox

What is the difference between append and appendChild ?

Hello, i'm used to use append in every situation, if i'm not wrong append is always working while appendChild not.

So in what case would it be better to use appendChild instead of append ?

Dave StSomeWhere
Dave StSomeWhere
19,785 Points

The main differences mentioned in MDN Docs is:

Differences from Node.appendChild():

  • ParentNode.append() allows you to also append DOMString object, whereas Node.appendChild() only accepts Node objects.
  • ParentNode.append() has no return value, whereas Node.appendChild() returns the appended Node object.
  • ParentNode.append() can append several nodes and strings, whereas Node.appendChild() can only append one node.

1 Answer