const ListNode = require('../../helpers/ListNode')

const insertIterative = (headNode, element) => {
  let node = new ListNode(element)

  if (headNode) {
    let currentNode = headNode

    while (currentNode.next) {
      currentNode = currentNode.next
    }

    currentNode.next = node
  }
}

module.exports = insertIterative
