insert as first element javascript code example
Example 1: javascript append how first element
// 2018+ Version
parentElement.prepend(newFirstChild)
Example 2: js insertbefore
// The Node.insertBefore() method inserts a node before a
// reference node as a child of a specified parent node.
let insertedNode = parentNode.insertBefore(newNode, referenceNode)