let insertedNode = parentNode.insertBefore(newNode, referenceNode)
insertedNode:
The node being inserted (the same as newNode)
parentNode
The parent of the newly inserted node.
newNode
The node to be inserted.
referenceNode
The node before which newNode is inserted. If this is null, then newNode is inserted at the end of parentNode's child nodes.
Note: referenceNode is not an optional parameter. You must explicitly pass a Node or null. Failing to provide it or passing invalid values may behave differently in different browser versions.
Note: There is no insertAfter() method. It can be emulated by combining the insertBefore method with Node.nextSibling
.