/* amethod to use in class LinkedList
to remove duplicate node*/
removeDuplicate() {
if (this.head) {
let current = this.head;
while (current.next != null) {
if (current.value == current.next.value)
current.next = current.next.next;
else
current = current.next;
}
}
return this;
}