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

+1-1
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

+4
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)