Skip to content

Commit 9ba3fba

Browse files
committed
fix: remove extra semicolons
1 parent 194e302 commit 9ba3fba

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Data-Structures/Linked-List/SinglyLinkedList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class LinkedList {
4545

4646
// Returns the tail
4747
tail () {
48-
return this.tailNode?.data || null
48+
return this.tailNode?.data ?? null
4949
}
5050

5151
// Return if the list is empty

Data-Structures/Linked-List/test/SinglyLinkedList.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ describe('SinglyLinkedList', () => {
166166

167167
list.addFirst(30)
168168
expect(list.tail()).toBe(20)
169+
170+
// check for a falsy tail data
171+
list.addLast(false)
172+
expect(list.tail()).toBe(false)
169173
})
170174

171175
it('Check size', () => {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy