TypeError: "x" has no properties

訊息

TypeError: null has no properties
TypeError: undefined has no properties

錯誤類型

哪裡錯了?

null (en-US)undefined (en-US) 並沒有可訪問的屬性。

示例

js
null.foo;
// TypeError: null has no properties

undefined.bar;
// TypeError: undefined has no properties

參見