Stack {class constructor () { the this .list = []; } // stack the Push (Item) { the this .list.push (Item); } // outbound Pop () { return the this .list.pop () ; } // determines whether the stack is empty GetIsEmpty () { return the this .list.length == 0 ; } // stack size GetSize () { return the this .list.length; } //清空栈 Clear(){ this.list=[]; } //读出栈数据 Read(){ console.log(this.list.toString()); } } //使用 let stackInfo=new stack(); stackInfo.GetIsEmpty();//true stackInfo.Push(11); stackInfo.Push(10); stackInfo.Read();//11,10 stackInfo.GetSize();//2 stackInfo.Pop();//10 stackInfo.Read();//11