数据结构-栈

#

LIFO: Last In First Out(后进先出)

wikipedia: https://zh.wikipedia.org/wiki/%E5%A0%86%E6%A0%88 (opens new window)

# 数组实现

const stack = []

// 入栈
stack.push(0)
stack.push(1)
stack.push(2)

// 出栈
const popVal = stack.pop()
1
2
3
4
5
6
7
8
9