Note: Array - leoxiong7289/JS-notebook GitHub Wiki

Array

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

Array  Func cheatsheet