@@ -23,9 +23,9 @@ export default class DoublyLinkedList {
2323 // Make new node to be a head.
2424 const newNode = new DoublyLinkedListNode ( value , this . head ) ;
2525
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.
2929 if ( this . head ) {
3030 this . head . previous = newNode ;
3131 }
@@ -57,7 +57,7 @@ export default class DoublyLinkedList {
5757 // Attach new node to the end of linked list.
5858 this . tail . next = newNode ;
5959
60- // Attach current tail to the new node's previous reference
60+ // Attach current tail to the new node's previous reference.
6161 newNode . previous = this . tail ;
6262
6363 // Set new node to be the tail of linked list.
@@ -83,10 +83,10 @@ export default class DoublyLinkedList {
8383 deletedNode = currentNode ;
8484
8585 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.
8787 this . head = deletedNode . next ;
8888
89- // set new head's previous to null
89+ // Set new head's previous to null
9090 if ( this . head ) {
9191 this . head . previous = null ;
9292 }
0 commit comments