Note: Array - leoxiong7289/JS-notebook GitHub Wiki
Array
- 支持作为Queue的结构:
- shift and push
- FIFO: First-In-First-OUT
- shift and push
- 也支持作为Stack的结构:
- push and pop
- LIFO: Last-In-First-Out
- push and pop
- 同时支持此两种结构,双端队列(
deque
: double-end queue) - 末端操作比前端操作更快(
push/pop
>shift/unshift
) Array.length
本质上是MaxIndex + 1
, 可以手动修改Array.length = 0
is the best way to clear arrays