()
| 10 | } |
| 11 | |
| 12 | pop() { |
| 13 | if (this.isEmpty()) { |
| 14 | return 'Underflow'; |
| 15 | } |
| 16 | |
| 17 | const item = this._items[this._count - 1]; |
| 18 | this._count--; |
| 19 | |
| 20 | for (let i = this._count; i < this._items.length; i++) { |
| 21 | this._items[i] = this._items[i + 1]; |
| 22 | } |
| 23 | |
| 24 | this._items.length = this._count; |
| 25 | return item; |
| 26 | } |
| 27 | |
| 28 | peek() { |
| 29 | if (this.isEmpty()) { |
no test coverage detected