interface Stack { _items: any push(element: any): void pop(): any top(): any size(): any isEmpty(): any clear(): any } //用Symbol添加私有属性 class Stack { _items: any = Symbol() constructor() { this._items = [] } push(element: any): void { this._items.push…