We can refactor the remove method and use the getElementAt method that has been created. To do so, we can replace lines {4} to {8} as follows:
if (index === 0) { // logic for first position} else { const previous = this.getElementAt(index - 1); current = previous.next; previous.next = current.next;}this.count--; // {9}