insert(value) {
    let newNode = new Node(value);
    if (!this.head) {
      this.head = newNode;
      this.tail = newNode;
    } else {
      newNode.next = this.head;
      this.head = newNode;
    }
    this.length++;
  }
// insert node at the start of linked list
insert node at the start of linked list
insert node at the start of linked list
insert(value) {
    let newNode = new Node(value);
    if (!this.head) {
      this.head = newNode;
      this.tail = newNode;
    } else {
      newNode.next = this.head;
      this.head = newNode;
    }
    this.length++;
  }
insert ( value ) { let newNode = new Node ( value ) ; if ( ! this . head ) { this . head = newNode ; this . tail = newNode ; } else { newNode . next = this . head ; this . head = newNode ; } this . length ++ ; }
insert node at the start of linked list
insert node at the start of linked list