add(key, value) {
    const index = this.hash(key);

    if (!this.table[index]) {
      this.table[index] = new LinkedList();
    }

    let bucketItem = this.table[index].head;
    while (bucketItem) {
      if (Object.keys(bucketItem.data)[0] === key) {
        throw new Error('this item already exists in the table');
      }
      bucketItem = bucketItem.next;
    }

    let keyValuePair = { [key]: value };
    this.table[index].append(keyValuePair);
  }
// add new key value to hash table
add new key value to hash table
add new key value to hash table
add(key, value) {
    const index = this.hash(key);
    if (!this.table[index]) {
      this.table[index] = new LinkedList();
    }
    let bucketItem = this.table[index].head;
    while (bucketItem) {
      if (Object.keys(bucketItem.data)[0] === key) {
        throw new Error('this item already exists in the table');
      }
      bucketItem = bucketItem.next;
    }
    let keyValuePair = { [key]: value };
    this.table[index].append(keyValuePair);
  }
add ( key , value ) { const index = this . hash ( key ) ; if ( ! this . table [ index ] ) { this . table [ index ] = new LinkedList ( ) ; } let bucketItem = this . table [ index ] . head ; while ( bucketItem ) { if ( Object . keys ( bucketItem . data ) [ 0 ] === key ) { throw new Error ( 'this item already exists in the table' ) ; } bucketItem = bucketItem . next ; } let keyValuePair = { [ key ] : value } ; this . table [ index ] . append ( keyValuePair ) ; }
add new key value to hash table
add new key value to hash table