Wildsky's Blog

  • home
  • bookshelf
  • about
  • Blogroll
  • english

JavaScript Array 中,還有一種情況叫 Empty Slot

2020 年 12 月 27 日

原討論串在這邊: https://twitter.com/wildskyf/status/1234412013796741120

簡單說,new Array(3) 出來的會是 [<Empty Slot>, <Empty Slot>, <Empty Slot>] 而非 [undefined, undefined, undefined]。

但 Mac 版的火狐有 bug:https://bugzilla.mozilla.org/show_bug.cgi?id=1580727,會把 顯示成 undefined,導致我誤會了。

Wildsky's Blog © 2014-2024 All rights reserved