class Stack {
constructor() {
this.array = [];
}
peek() {
return this.array[this.array.length - 1];
}
push(value) {
this.array.push(value);
}
pop() {
this.array.pop();
return this;
}
}
const stack = new Stack();
stack.push(10);
stack.push(12);
stack.push(11);
stack.push(14);
stack.pop();
stack.pop();
stack.pop();
// stack.pop();
stack.pop();
// stack.pop();
// stack.pop();
console.log(stack.pop());