appendBefore code example Example: appendBefore let insertedNode = parentNode.insertBefore(newNode, referenceNode)