What's the difference between replaceChild() and replaceWith()?
The main difference is that replaceChild() must be called on the parent element and takes two arguments (new node, old node), while replaceWith() is called directly on the element to be replaced. replaceWith() is more convenient as it doesn't require a reference to the parent node. For example: oldElement.replaceWith(newElement) vs parentElement.replaceChild(newElement, oldElement). Both methods accomplish the same task but with different syntax patterns.