function appendElementToBody(tagName, text) {
  var el = document.createElement(tagName),
      textNode;

  if (text) {
    textNode = document.createTextNode(text);
    el.append(textNode);
  }

  document.body.append(el);
  return el;
}
A function for the common task of appending an
element to the document body for applying anchors to.
@param {String} tagName  - The string for the tag name you want to create.
@param {String} text     - The text for the textnode inside the tag (optional).
@return {HTMLElement}    - The element you've appended.