frontend-challenges
frontend-challenges copied to clipboard
91 - Stack - javascript
index.js
class Stack {
constructor() {
this.items = [];
}
size() {
return this.items.length;
}
peek() {
return this.items.at(-1);
}
push(item) {
return this.items.push(item);
}
pop() {
return this.items.pop();
}
isEmpty() {
return this.size() === 0;
}
}
export { Stack };