UNPKG

ds-algo-study

Version:

Just experimenting with publishing a package

40 lines (30 loc) 487 B
// @ts-check export default class StackArray { constructor() { this.items = []; } push(element) { this.items.push(element); } pop() { return this.items.pop(); } peek() { return this.items[this.items.length - 1]; } isEmpty() { return this.items.length === 0; } size() { return this.items.length; } clear() { this.items = []; } toArray() { return this.items; } toString() { return this.items.toString(); } }