此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

TypeError: "x" has no properties

错误信息

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

错误类型

TypeError.

哪里出错了?

nullundefined中,没有你需要的属性。

示例

js
null.foo;
// 错误类型:null 没有这个属性

undefined.bar;
// 错误类型:undefined 没有这个属性

参考