| 37 | } |
| 38 | |
| 39 | class Stack { |
| 40 | constructor() { |
| 41 | this.data = []; |
| 42 | } |
| 43 | size() { |
| 44 | return this.data.length; |
| 45 | } |
| 46 | isEmpty() { |
| 47 | return this.size() === 0; |
| 48 | } |
| 49 | push(value) { |
| 50 | this.data.push(value); |
| 51 | } |
| 52 | pop() { |
| 53 | return this.data.pop(); |
| 54 | } |
| 55 | peek() { |
| 56 | if (this.isEmpty()) return null; |
| 57 | return this.data[this.size() - 1]; |
| 58 | } |
| 59 | } |
nothing calls this directly
no outgoing calls
no test coverage detected