* Read the element at the front of the queue without removing it. * @return {*}
()
| 21 | * @return {*} |
| 22 | */ |
| 23 | peek() { |
| 24 | if (this.isEmpty()) { |
| 25 | return null; |
| 26 | } |
| 27 | |
| 28 | return this.linkedList.head.value; |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Add a new element to the end of the queue (the tail of the linked list). |