结构类型:
1.栈:(JavaScript中没有栈这种数据结构,可以创造)
- 栈顶栈底
- 入栈出栈
- 后进先出

2.队列:
先进先出
模拟栈结构
<script>function Stack(){this.item =[];}/*push 入栈pop 出栈peek 获取栈顶isEmpty 判断栈是否为空size 可以看栈中有多少*/Stack.prototype.push =function(val){this.item.push(val);}Stack.prototype.pop =function(){var res =this.item.pop();return res;}Stack.prototype.peek = function(){return this.item[this.items.length-1]}var s =new Stack();s.push(2);s.push(3);console.log(s.item);console.log(s.pop());</script>
