aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/errors/no_properties/index.html
blob: 5e904dd8ab7406af4a59dc53a37168b1e2f5fad6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
title: 'TypeError: "x" has no properties'
slug: Web/JavaScript/Reference/Errors/No_properties
translation_of: Web/JavaScript/Reference/Errors/No_properties
---
<div>{{jsSidebar("Errors")}}</div>

<h2 id="错误信息">错误信息</h2>

<pre class="syntaxbox">TypeError: null has no properties
TypeError: undefined has no properties
</pre>

<h2 id="错误类型">错误类型</h2>

<p>{{jsxref("TypeError")}}.</p>

<h2 id="哪里出错了">哪里出错了?</h2>

<p> {{jsxref("null")}}{{jsxref("undefined")}}中,没有你需要的属性。</p>

<h2 id="例子">例子</h2>

<pre class="brush: js example-bad">null.foo;
// 错误类型: null没有这个属性

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

<h2 id="参考">参考</h2>

<ul>
 <li>{{jsxref("null")}}</li>
 <li>{{jsxref("undefined")}}</li>
</ul>