@@ -23,9 +23,9 @@ export default class DoublyLinkedList {
23
23
// Make new node to be a head.
24
24
const newNode = new DoublyLinkedListNode ( value , this . head ) ;
25
25
26
- // If there is head, then it won't be head anymore
27
- // Therefore, make its previous reference to be new node (new head)
28
- // Then mark the new node as head
26
+ // If there is head, then it won't be head anymore.
27
+ // Therefore, make its previous reference to be new node (new head).
28
+ // Then mark the new node as head.
29
29
if ( this . head ) {
30
30
this . head . previous = newNode ;
31
31
}
@@ -57,7 +57,7 @@ export default class DoublyLinkedList {
57
57
// Attach new node to the end of linked list.
58
58
this . tail . next = newNode ;
59
59
60
- // Attach current tail to the new node's previous reference
60
+ // Attach current tail to the new node's previous reference.
61
61
newNode . previous = this . tail ;
62
62
63
63
// Set new node to be the tail of linked list.
@@ -83,10 +83,10 @@ export default class DoublyLinkedList {
83
83
deletedNode = currentNode ;
84
84
85
85
if ( deletedNode === this . head ) {
86
- // set head to second node, which will become new head
86
+ // Set head to second node, which will become new head.
87
87
this . head = deletedNode . next ;
88
88
89
- // set new head's previous to null
89
+ // Set new head's previous to null
90
90
if ( this . head ) {
91
91
this . head . previous = null ;
92
92
}
0 commit comments