* @return {*}
()
| 20 | * @return {*} |
| 21 | */ |
| 22 | peek() { |
| 23 | if (this.isEmpty()) { |
| 24 | // If the linked list is empty then there is nothing to peek from. |
| 25 | return null; |
| 26 | } |
| 27 | |
| 28 | // Just read the value from the start of linked list without deleting it. |
| 29 | return this.linkedList.head.value; |
| 30 | } |
| 31 | |
| 32 | /** |
| 33 | * @param {*} value |