mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-11-10 11:09:43 +08:00
Merge 2dc6338165
into ca3d16dcce
This commit is contained in:
commit
2ef6929c93
@ -48,6 +48,12 @@ export default class LinkedList {
|
||||
}
|
||||
|
||||
// Attach new node to the end of linked list.
|
||||
let current = this.head;
|
||||
while (current.next !== null) {
|
||||
current = current.next;
|
||||
}
|
||||
current.next = newNode;
|
||||
|
||||
this.tail.next = newNode;
|
||||
this.tail = newNode;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user