fix error in SinglyLinkedList head method (#1322)

* fix error in SinglyLinkedList head method

* test: update check head test for SinglyLinkedList

* fix: code style error

* fix: remove extra semicolons

---------

Co-authored-by: Bekzod <bekzodisakov18@gmail.com>
This commit is contained in:
BekzodIsakov
2023-05-15 13:05:09 +05:00
committed by GitHub
parent 331a4d26cf
commit 1666c3a0be
2 changed files with 10 additions and 2 deletions

View File

@ -40,12 +40,12 @@ class LinkedList {
// Returns the head
head () {
return this.headNode?.data || null
return this.headNode?.data ?? null
}
// Returns the tail
tail () {
return this.tailNode?.data || null
return this.tailNode?.data ?? null
}
// Return if the list is empty