append(value) {
    let newNode = new Node(value);
    if (!this.head) {
      this.head = newNode;
      this.tail = newNode;
    } else {
      this.tail.next = newNode;
      this.tail = newNode;
    }
    this.length++;
  }
// adds a new node with the given value to the end of the list
adds a new node with the given value to the end of the list
adds a new node with the given value to the end of the list
append(value) {
    let newNode = new Node(value);
    if (!this.head) {
      this.head = newNode;
      this.tail = newNode;
    } else {
      this.tail.next = newNode;
      this.tail = newNode;
    }
    this.length++;
  }
append ( value ) { let newNode = new Node ( value ) ; if ( ! this . head ) { this . head = newNode ; this . tail = newNode ; } else { this . tail . next = newNode ; this . tail = newNode ; } this . length ++ ; }
adds a new node with the given value to the end of the list
adds a new node with the given value to the end of the list